Topics
Replies

PorkChop_75
13 Aug 2021, 12:32

RE: Did you get this working?

Hi, just wondering if you ever got this working? i too have been trying similar, even combining in one row as per below but no luck so far!
i simply tried combining to individual working samples, but seem to be missing something!

 

if ((_macdHistogram.Histogram.Last(1) > 0 && _macdHistogram.Histogram.Last(2) <= 0) && (_stochasticOscillator.PercentK.HasCrossedAbove(_stochasticOscillator.PercentD, 0) && _stochasticOscillator.PercentK.Last(1) <= 20))
            {
                ClosePositions(TradeType.Sell);

                ExecuteMarketOrder(TradeType.Buy, SymbolName, _volumeInUnits, Label, StopLossInPips, TakeProfitInPips);
            }
            else if ((_macdHistogram.Histogram.Last(1) < 0 && _macdHistogram.Histogram.Last(2) >= 0) && (_stochasticOscillator.PercentK.HasCrossedBelow(_stochasticOscillator.PercentD, 0) && _stochasticOscillator.PercentK.Last(1) >= 80))

 

Would be great to get some help on this one.

 

amosmsiwa said:

In trying to keep the programming code as clean as possible, can the CRL indentify these as identical statements or not?

if ((_macdH.Histogram.LastValue > _macdH.Signal.LastValue) && (_macdH.Histogram.LastValue - _macdH.Signal.LastValue > 0))
            {

                if ((_stochO.PercentK.LastValue > _stochO.PercentD.LastValue) || (_stochO.PercentK.LastValue > 50))
                {
                    if ((_rsi.Result.LastValue > 51) && (_pSar.Result.LastValue < MarketSeries.Close.LastValue))
                    {
                        Print("BUY...." + this.Symbol);

                    }
                }

 

if ((_macdH.Histogram.LastValue > _macdH.Signal.LastValue) && (_macdH.Histogram.LastValue - _macdH.Signal.LastValue > 0)) &&((_stochO.PercentK.LastValue > _stochO.PercentD.LastValue) || (_stochO.PercentK.LastValue > 50))(_rsi.Result.LastValue > 51) && (_pSar.Result.LastValue < MarketSeries.Close.LastValue))

 {
                        Print("BUY...." + this.Symbol);

                    }

 

 


@PorkChop_75