Hey Guys.
Could someone please tell me what the code is for the (daily) 50EMA to have been above the 200EMA for the last 3 months?
Thank you.
Stephen
Can anybody help me with this?
Do you got coding knowledge already? If yes, please look at how to make loop in the past to test if your MA50 is above the MA200, if yes do a variable incrementation and if this variable >= 3Months*20Days, you got what you were looking for.
Thank you for your reply Nicholas. I do not have much coding experience. What would be the code for what you say?
Here is the code you need to test if the MA50 was above the MA200 in the last 60 bars :
MA50 = average[50](close)
MA200 = average[200](close)
count = 0
for i = 1 to 60 do
if MA50[i]>MA200[i] then
count = count +1
endif
next
if count=60 then
result = 1
else
result = 0
endif