# Objective: to make my own Fibonacci Arc indicator for the purpose of only Exiting my trades with no human input, meaning "automated" the Fibonacci Arc provided in the drawing tools cannot be access in code meaning I cannot automate my trading, so I have to code one myself to myself.
#----->Start of Slope Calculations to determine only if the trend is Upward or Downward and nothing else <-----
def a = HighestAll(high);
def b = LowestAll(low);
def barnumber = barNumber();
def c = if high == a then barnumber else double.nan;
def d = if low == b then barnumber else double.nan;
rec highnumber = compoundValue(1, if IsNaN(c) then highnumber[1] else c, c);
def highnumberall = HighestAll(highnumber);
rec lownumber = compoundValue(1, if IsNaN(d) then lownumber[1] else d, d);
def lownumberall = LowestAll(lownumber);
def upward = highnumberall > lownumberall;
def downward = highnumberall < lownumberall;
def x = AbsValue(lownumberall - highnumberall );
def slope = (a - b) / x;
def slopelow = (b - a) / x;
def line = b + (slope * (barnumber - lownumber));
def linelow = a + (slopelow * (barnumber - highnumber));
def currentlinelow = if barnumber <= lownumberall then linelow else double.nan;
def currentline = if barnumber <= highnumberall then line else double.nan;
#----->END<-----
#----->Start of drawing a circle around the high close price if the Trend is Upward or a circle on the lowest point close price if the Trend is Downward and nothing else <-----
def r = ((1.618)/(highnumberall)) ;
plot Arc1 = fold i = 0 to 360 while i != 360 do ( highnumberall ) + (i*((r*2*double.Pi)/(360))) and ( highnumberall ) - (i*((r*2*double.Pi)/(360)));
Arc1.SetDefaultColor(Color.DARK_GREEN);
Arc1.SetStyle(Curve.FIRM);
def r2 = ((23.6)/(lownumberall));
plot Arc2 = fold i2 = 0 to 360 while i2 != 360 do ( lownumberall ) - i2*((r2*2*double.Pi)/(360)) and ( lownumberall ) + (i2*((r2*2*double.Pi)/(360))) ;
Arc2.SetDefaultColor(Color.pINK);
Arc2.SetStyle(Curve.FIRM);
#----->END<-----