GD
Simple advice needed to do calculation with open, close prices +
02 Oct 2015, 16:56
Hi! Can someone help?
I can't figure out a code that takes the high-, low-, open- and close -prices of a bar, each time a bar closes...
After the bar closes it subtracts:
1: open price from the high and
2: the close price from the high.
if 1 < 2, it creates a sell position, with adjustable lot size, (prefer 0,01 lot), and adjustable time period (1h,5h etc).
I need these infos to develop it further.
Thanks for your kindness!

moneybiz
02 Oct 2015, 19:17
protected override void OnBar() { // The new bar's index is 0, the closed bar's index is 1. var prevBarOpenPrice = MarketSeries.Open.Last(1); var prevBarClosePrice = MarketSeries.Close.Last(1); var prevBarHighPrice = MarketSeries.High.Last(1); var prevBarLowPrice = MarketSeries.Low.Last(1); if (prevBarHighPrice - prevBarOpenPrice < prevBarHighPrice - prevBarClosePrice) { // Open Sell. } }Add the lines above to your bot.
@moneybiz