Help with change in entry price

Created at 25 Jul 2013, 23:05
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!
GA

Garcho

Joined 24.07.2013

Help with change in entry price
25 Jul 2013, 23:05


Hello, 

Please help with this  code. I am creating a buy limit option setting the target price, it gets created fine but when it is executed the Entry Price has change. 

 

Thanks, 

Best regards, 

 

 protected override void OnBar()
        {
                   
            int index = MarketSeries.OpenTime.Count - 1;
            var _startTime = MarketSeries.OpenTime[index].Date.AddHours(22); 
            var _cadahora = MarketSeries.OpenTime[index]; 
                            
            if (_cadahora == _startTime) 
                {        
                    double  TargetPrice = MarketSeries.Close.LastValue + 75*Symbol.PipSize;
                    double? StopLoss = MarketSeries.Close.LastValue + 50*Symbol.PipSize;
                    double? TakeProfit = MarketSeries.Close.LastValue + 140*Symbol.PipSize;
                    var Expiration =_startTime.Date.AddHours(23);
                    Trade.CreateBuyLimitOrder(Symbol,Volume,TargetPrice,StopLoss,TakeProfit,Expiration);
                }
                    


@Garcho
Replies

Garcho
25 Jul 2013, 23:56

Found the problem...

 


@Garcho