Problems with my code

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #186510 quote
    daxtrader3
    Participant
    Junior

    @Robertogozzi, @ Nicolaas

    Can you help my with my code?

    Some problems with my pro real time.

    I won’t give any backtest.

    Thanks in advance!!

    Tom

    Bloodgood.itf
    #186531 quote
    robertogozzi
    Moderator
    Master
    • Post your topic in the correct forum:
      _ ProRealTime Platform Support: only platform related issues.
      _ ProOrder: only strategy topics.
      _ ProBuilder: only indicator topics.
      _ ProScreener: only screener topics
      _ General Discussion: any other topics.
      _ Welcome New Members: for new forum members to introduce themselves.
      I moved it from ProBuilder.
    • Do not append your code to existing topics, create a new one.
    • Give your topic a meaningful title. Describe your question or your subject in your title. Do not use meaningless titles such as ‘Coding Help Needed’

    Read carefully the main rules, highlighted in yellow below.

    ALLWAYS post the code, unless it’s hundreds of lines of code, in addition to the ITF file.

    // TOM DERYCKE
    DEFPARAM CumulateOrders = false
    
    // MONEY MANAGEMENT
    REINV = 0
    LEVIER = 1
    CAPITALinit = 10000
    
    IF REINV = 0 THEN
    n = levier
    ELSIF REINV = 1 THEN
    capital = CAPITALinit + strategyprofit
    n = (capital / CAPITALinit)*levier
    IF n < 1 THEN
    n = 1
    ENDIF
    n = round(n)
    ENDIF
    
    // 4 hour TF (get the trend of the 4 hour chart)
    timeframe (4 hour, updateonclose)
    MA200 = (Average[200](close))
    bulltrend = close > MA200
    
    
    // "default" timeframe (the timeframe you will launch the strategy on)
    timeframe (1 hour, default)
    MA18 = (Average[18](close))
    MA22 = (Average[22](close))
    
    
    buyc =  MA18 crosses over MA22
    sellc = MA22 crosses under MA18
    
    
    IF bulltrend and buyc THEN
    Buy n contracts at market
    ENDIF
    
    IF sellc THEN
    Sell n contracts at market
    ENDIF

    What’s wrong with your code?

    On which  instrument/asset/fx pair and time frame are you using it?

    #186532 quote
    deletedaccount051022
    Participant
    New

    Hi daxtrader3

    If you insert “graph buyc” and “graph sellc” at the end of your code you will see that both buy and sell are triggered at the same time.  That’s because the logic for both buy and sell variables are identical  for going long or short.

     

    Hope this helps

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

Problems with my code


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
daxtrader3 @daxtrader3 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by deletedaccount051022
4 years ago.

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