Highest / Lowest price

Created at 18 Feb 2019, 14:21
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!
JE

jelle2500

Joined 25.11.2017

Highest / Lowest price
18 Feb 2019, 14:21


hello,

I need to get:

- The highest price if i open a sell trade.

- The lowest price if i open a sell trade

For testing i need to adjust the number of candles (Looking back) into a parameter...

--------------------------------------------------------------------------------------------------------------------------------------------

for example:

 

         [Parameter("Number of candles", DefaultValue = 1, MinValue = 1, Step = 1)]
        public int NumberOfCandles { get; set; }

Take trade:

If ( BuyLogic() && LowestPrice())

.......

Else if ( SellLogic() && HighestPrice())

...........

Bool for buy: 

Private bool LowestPrice()

{

MarketSeries.Low.Last(1) < MarketSeries.Low.Last(2 - NumberOfCandles)

}

 

Bool for sell:

Private Bool HighestPrice()

{

MarketSeries.High.Last(1) > MarketSeries.High.Last(2 - NumberOfCandles)

--------------------------------------------------------------------------------------------------------------------------------------------------------

So MarketSeries.High.Last(1) must be higher then High.Last(2) all the way up to what 1 set in the parameter.

and MarketSeries.Low.Last(1) must be lower then Low.Last(2) all the way up to whatever i set on parameter


@jelle2500