Write a calculation of the RSI indicator, overbought and oversold range.
The problem is that, if you put it in a flat condition, sometimes it won't trigger, I don't know why.
function RSI_Signal(){ var records = exchange.GetRecords(); while(!records || records < 50){ records = exchange.GetRecords(); Sleep(Interval); } var rsi = TA.ATR(records,14); var len = records.length; if ( rsi[len-1] < rsi[len-2] && rsi[len-1] < 30 && rsi[len-2] >= 30 ){ return 1; } if ( rsi[len-1] > rsi[len-2] && rsi[len-1] > 70 && rsi[len-2] <= 70 ) { return 2 } return 0;
MrSwingingGood drop, copied a stop loss code from the post, then tried to add an indicator to play the game, and when I ran it on the real disk, I found that the condition was not triggered.
The grassIt's hard to see the problem.