Code Function Help needed (HasCrossedBelow or Above)

Created at 11 Sep 2017, 09:30
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
AM

amsman

Joined 22.11.2016

Code Function Help needed (HasCrossedBelow or Above)
11 Sep 2017, 09:30


//if (rsi.Result.Last(0) < RSILow)
                    if (rsi.Result.HasCrossedAbove(RSILow, 2)) 
                    {
                        if (Buy == true)
                        {
                            ExecuteMarketOrder(TradeType.Buy, Symbol, VolumeInUnits, InstanceName, StopLossPips, TakeProfitPips);
                            PosOpen++;
                            //OpenIndex = last;
                        }
                    }
                    //else if (rsi.Result.Last(0) > RSIHigh)
                    else if (rsi.Result.HasCrossedBelow(RSIHigh, 2))
                    {
                        if (Sell == true)
                        {
                            ExecuteMarketOrder(TradeType.Sell, Symbol, VolumeInUnits, InstanceName, StopLossPips, TakeProfitPips);
                            PosOpen++;
                            //OpenIndex = last;

To whom can help...

I have developed a cBot which is working well, but does not seem to open a position everytime the RSI crosses over the RSIHigh (eg: 72) or RSILow (eg: 28) values. It appears to execute every 3 or 4 crosses on the 1min/5min Chart.

I understand the number (ie: 2) controls the dataset comparisions and I initially had the RSIHigh/Low value set at 0 (now 2) which caused positions to open even less frequently, if at all.

Should this value be -2 and 2 (or another number) to make the Bot execute every cross of the RSI Indicator 72/28 values?

Thanks in Advance


 

@amsman