i’ve written the following code to create a buy alert.
SET Ag = (OPEN+LOW+CLOSE+HIGH)/4
LAST>(Ag+(Ag*0.5))
What i wanted to check is when the market opens it should calculate the first 10mins candle open, high, low and close to calculate the avg (SET Ag = (OPEN+LOW+CLOSE+HIGH)/4)
now it should give me a buy alert when the price is greater than avg but its showing me an error when i run the script any help would be appreciative.
Thanks dude for the answer, Yes you are right i realised that later cos its always taking the latest bars it never give buy or sell signals.
Is there any work around? at least i need the avg constant for 40bars then for the next 40bars new avg can be calculated. does it make any sense?