A simple n-days breakout system

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #60500 quote
    Ivan Donatiello
    Participant
    Average

    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 🙂

    TS-TURTLES-SIMILAR.png TS-TURTLES-SIMILAR.png
    #60510 quote
    Nicolas
    Keymaster
    Master

    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.

    #60524 quote
    Ivan Donatiello
    Participant
    Average

    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 🙂 🙂 🙂

    #101322 quote
    Ivan Donatiello
    Participant
    Average

    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?

    #101329 quote
    Vonasi
    Moderator
    Master

    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.

    #101330 quote
    Vonasi
    Moderator
    Master

    Also change line 8 to:

    stoploss = highest[n](high)[1] - close

    otherwise the stoploss value is negative.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

A simple n-days breakout system


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by Vonasi
6 years, 8 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/25/2018
Status: Active
Attachments: 1 files
Logo Logo
Loading...