Hello everyone Ivan Donatiello Here,
My proposal is to program a trading system similar to the orginal turtles trading rule.
The conditions are simple, they are as follows:
1. Buy buy stop at highest n days
2. Stop loss at lowest n days
3 exit at n days
The exact opposite for the trade short!
You can help me?
If there was already an equal or similar argument to implement the code, please forgive me and link it to me 🙂
Topic moved to ProOrder support forum, since related to automatic trading. Please use the ProRealTime forum support only for platform related queries.
This strategy is very similar to the “turtle trading strategy” IMO.
It could be coded like this: (not tested)
defparam cumulateorders=false
n = 20
if not longonmarket then
buy 1 contract at highest[n](high)[1] stop
stoploss = close-lowest[n](low)[1]
endif
set stop loss stoploss
if onmarket and barindex-tradeindex(1)>=n then
sell at market
endif
Since you used the N variable 3 times in your description, I used it also 3 times: for the highest high, lowest low and bars quantity to close order.
I’, sorry for having made a wrong section.
Yes Nicolas, it’s about that system, I’m trying to adapt everything to my operation, I do a search and insert my rules.
If I find something good, I share
Thank you 🙂 🙂 🙂
Greetings to all, I tried to encode the short version of this system. But I couldn’t, this is the code I got but it doesn’t work:
defparam cumulateorders=false
n = 10
n1 = 20
if not longonmarket then
SELLSHORT 1 contract at lowest[n](low)[1] stop
stoploss = close-highest[n](high)[1]
endif
set stop loss stoploss
if onmarket and barindex-tradeindex(1)>=n1 then
sell at market
endif
Can anyone help me figure out where the problem is?
Ivan Donatiello – Please use the Insert PRT Code’ button whenever you post code in your replies to make it easier for others to read. I have tidied up your post for you 🙂
Replace SELL with EXITSHORT in your code.
Also change line 8 to:
stoploss = highest[n](high)[1] - close
otherwise the stoploss value is negative.