Last Candles

Created at 19 Nov 2015, 09:18
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!
RK

rkokerti

Joined 28.06.2012

Last Candles
19 Nov 2015, 09:18


Hi,

I would like to identify the last Long(open<close) and last Short(open>close) candles from the latest 20 bars in the "Index" dataseries? So, I'd like to see only 2 triggers. One for last long and another for last short candle.

I wrote this code, but it shows 20 trigger point. How can I find the last 2?

Can someone complete my code please?

    if (IsRealTime)
 	{
 	
        for(int i = index -20; i < index +1; i++)
 	    {
 	        if(MarketSeries.Open[i] > MarketSeries.Close[i])
            {             	      
                LongEntry[i] = MarketSeries.High[i];
                ShortEntry[i] = double.NaN;
            }
            
 	        if(MarketSeries.Open[i] < MarketSeries.Close[i])
            {             	      
                ShortEntry[i] = MarketSeries.Low[i];
                LongEntry[i] = double.NaN;
            }
        }            
 	}

THX!


@rkokerti
Replies

Spotware
23 Nov 2015, 02:41

Dear Trader,

We do not provide coding assistance services. We more than glad to assist you with specific questions about cAlgo.API. You can contact one of our Partners or post a job in Development Jobs section for further coding assistance.


@Spotware