Developer Code Library

Indicators

On Price RSI Indicator

// — settings rsiperiod=14 ATRperiod = 20 maPeriod = 20 maMethod = 0 overBought = 70 overSold = 30 // — end of settings maPrice = customclose dTR = 0 for i = 0 to ATRperiod–1 dTR=dTR+max(abs(Dhigh(i)–Dlow(i)),max(abs(Dhigh(i)–Dclose(i+1)),abs(Dlow(i)–Dclose(i+1)))) next avgRange = dTR/ATRperiod maValue = average[maPeriod,maMethod](maPrice) rsivalue = rsi[rsiperiod](maPrice) //—- Buffer1=maValue Buffer2=maValue+(avgRange*(overBought–50)/100) […]

Stop Loss

Two Stage ATR Based Trailing Stop

Two Stage ATR Based Trailing Stop // ================trailing atr stop VIRTUAL================== if enabletsvir then // once stepsvir=0 once minatrdistvir=0 once atrtrailingperiodvir    = 2  // atr parameter once minstopvir              = 10   // minimum  distance if barindex=tradeindex then trailingstoplongvir    = 5  // trailing stop atr distance trailingstopshortvir    = 5   // trailing stop atr distance else if longonmarket then if […]

Stop Loss

ATR Based Trailing Stop

ATR Based Trailing Stop With In Built Graph Function // trailing stop atr once enablets=1 once displayts=1 if enablets then // once steps=0.05 once minatrdist=3 once atrtrailingperiod    = 14   // atr parameter value once minstop              = 10   // minimum trailing stop distance if barindex=tradeindex then trailingstoplong     = 5   // trailing stop atr […]