Page 1 of 1
How it is possible to define the All Time High as another Buy Condition?
Posted: Tue Mar 08, 2022 4:31 pm
by EveryDayBetter
How it is possible to define it as another Buy Condition, when I wanna say, that the stock should be not more than 10 percent under the All Time High?
Re: How it is possible to define the All Time High as another Buy Condition?
Posted: Wed Mar 09, 2022 9:24 am
by processingclouds
It would be something like this :
Code: Select all
var float ATH= 0.0
var float under10 = na
ATH := math.max(high, ATH)
under10 := ATH * 0.90
isLong = yourCondition and close > under10
Re: How it is possible to define the All Time High as another Buy Condition?
Posted: Wed Mar 09, 2022 6:57 pm
by EveryDayBetter
It works very well, thank you so much.