Need help with code

Created at 02 Aug 2023, 15:17
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!
DO

dominik.tedla0

Joined 27.02.2023

Need help with code
02 Aug 2023, 15:17


Hi I want to ask about my code.. I have ctrader version 4.6.7
in this line is still some problem what can I do with it?

TradeType tradeType = TradeType.Buy;
            double stopLossPrice = Symbol.Bid - Symbol.PipSize * StopLoss;
            double takeProfitPrice = Symbol.Bid + Symbol.PipSize * TakeProfit;

            openedPosition = ExecuteMarketOrder(tradeType, Symbol, LotSize, "Long Position", null, stopLossPrice, takeProfitPrice);


@dominik.tedla0
Replies

PanagiotisChar
03 Aug 2023, 05:37

Hi there,

Not sure what problem you are referring to but your stop loss and take profit are wrong. You need to pass stop loss and take profit in pips, not in actual price.

Aieden Technologies

Need help? Join us on Telegram


 


@PanagiotisChar