Buy stock when up 2,2% from openening price the same day and then has retracted down below a moving average of my choosing during a specefic timeframe say the first 60 min from market open.
I have tryied coding it whotout succses, having problems whit getting the % up to work.
You can try with the below code, the “trigger” variable is the one used to test the gap percent at the first opening hour. “endtime” is the time limit to test the price retraction below the moving average. There is no stop and limit in the code.