hi guys,
I would like to know how to write the code which is when the price touch ema 2 times, then the entry position should be at the second touching point on ema.
so anyone can tell me how to write?
thank you so much
Wing Tai Tin – Welcome to the forums. Please try to post in the correct forum with future topics. The ProOrder forum is the place for auto strategy related questions. I have moved your post. 🙂
Also please use meaningful topic titles – I have changed yours.
Try this (not tested):
[scode]
LookBack = 10
MyEma = average[20,1](close)
// LONG example
LongCond = (close > MyEma) and (low <= MyEma) and (summation[LookBack](low <= MyEma)[1])
If LongCond And not OnMarket Then
Buy 1 contract at Market
Endif
[/scode]
If you want to make sure price has also never closed below MyEma in the last LookBack bars, replace line 4 with:
[scode]
LongCond = (low <= MyEma) and (summation[LookBack](low <= MyEma)[1]) And (summation[LookBack](close >= MyEma) = LookBack)
[/scode]
thank you for your helping
but i dont really understand what is the difference between “longonmarket” “onmarket” “shortonmarket”
also, “if” and “if not”
for example:
if i want to entry buy position, i should
1. if longonmarket/onmarket then or
2. if not longonmarket/onmarket then
im so confuse how to use those codes.
thank you very much
i dont really understand what is the difference between “longonmarket” “onmarket” “shortonmarket”
Sounds like you need basic training? Have you ever coded before? It’s okay … I and many others on here hadn’t coded before we started using PRT .
Try reading the PRT Manual and / or do Nicolas video course.
https://www.prorealtime.com/en/pdf/probacktest.pdf
https://www.prorealcode.com/programming-with-prorealtime/