Pivot Points calculation for bot
Pivot Points calculation for bot
22 Aug 2017, 23:40
Hi,
I am creating a bot for pivot points, calculations are correct, but something is not working correctly because in backtest (timeframe: D1) it gives different takeprofit values.
Follow the code:
private void ExecuteStrategy() { var Daily = MarketData.GetSeries(TimeFrame.Daily); var High = Daily.High.Last(1); var Low = Daily.Low.Last(1); var Close = Daily.Close.Last(1); var Price = (Symbol.Ask + Symbol.Bid) / 2; var Pivot = (High + Low + Close) / 3; var R1 = 2 * Pivot - Low; var S1 = 2 * Pivot - High; var TakeProfifBuy = R1; var StopLossBuy = TakeProfifBuy / StopLossFactor; var TakeProfifSell = S1; var StopLossSell = TakeProfifSell / StopLossFactor; if (Price > Pivot) { ExecuteMarketOrder(TradeType.Buy, Symbol, VolumeInLots, Label, StopLossBuy, TakeProfifBuy); } if (Pivot > Price) { ExecuteMarketOrder(TradeType.Sell, Symbol, VolumeInLots, Label, StopLossSell, TakeProfifSell); } }
On August 15, 2017 we do the calculations on the 14th: > High: 109,798 > Low: 109,048 > Close: 109,653 > Pivot: 109,500 > R1: 109,951 > S1: 109,201
Why give me take profit on 111,756 instead 109,500?
Any Help ?
Thank you
Replies
DelFonseca
24 Aug 2017, 22:48
RE:
Spotware said:
Dear deltrader.pt@gmail.com,
It seems that your take profit/stop loss parameters are passed as absolute prices rather than in pips. Can you please check this?
Best Regards,
cTrader Team
Hello, Actually my stoploss / takeprofit is calculated as price but in the default calgo is in pips. Is it possible put stoploss / takeprofit as a price and not as pips? If so, can you help me? I have already done a search without success. thank you so much.
@DelFonseca
Spotware
23 Aug 2017, 09:40
Dear deltrader.pt@gmail.com,
It seems that your take profit/stop loss parameters are passed as absolute prices rather than in pips. Can you please check this?
Best Regards,
cTrader Team
@Spotware