Modular code

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #50656 quote
    Mansoor
    Participant
    Average
    I am developing a modular code which means you can add/delete any paragraph and it still works so it can easily be developed further over time.
    There are multiple conditions and each condition can be either zero or will be given a value based on how important that condition is. (Optimised by PRT) If the total value of all conditions is higher than Criteria (Again value of criteria determined  by PRT) then Buy. The code is only to buy and will only sell if trailing stop is triggered.
    Feel free to add your paragraph and condition and share here so we can all comment and develop like a team.

    //Acronyms: bb: buy c: condition1 cr: criteria1 f: fast s: slow ss: sell
    //Defparam Flatbefore = 090500
    //Defparam Flatafter = 145500
    //Timeframe: 1min
    Defparam CumulateOrders = False
    
    If Hour >= 13 Then
    size = 0
    Else
    size = 1
    Endif
    If (DayOfWeek = 5 and Hour >= 15) Then
    Sell At Market
    ExitShort At Market
    Quit
    Endif
    
    stp = 100
    stploss = 30
    targetpro = 100
    stratpro = -500
    
    ma1 = ExponentialAverage[300](close)
    
    c1 = 0
    c2 = 0
    c3 = 0 //more conditions to be added later
    
    If close > ma1 Then
    c1 = cr1
    Endif
    
    If MACD[180,390,135](close) > 0 Then
    c2 = cr2
    Endif
    
    total = c1 + c2 + c3
    If total >= criteria Then
    bb = 1
    Else
    bb = 0
    Endif
    
    If bb Then
    Buy size Contracts at Open - stp Stop
    Endif
    
    //risk management
    Set Stop Loss stploss
    Set Target Profit targetpro
    If StrategyProfit < stratpro Then
    Sell At Market
    ExitShort At Market
    Quit
    Endif
    

     

    Modular-2.itf
    #52368 quote
    AutoStrategist
    Participant
    Veteran

    Hi Mansoor, not entirely clear what you are trying to do but looks like something I tried a couple of years ago, a sort of simplistic machine learning algo .  I had it where each condition could be weighted and have a value of between 1 and 10 and combinations of indicators could be tested and when the total value of all the conditions reached a threshold determined via backtest e.g. > 50 then a signal would be generated.  I abandoned it as it soon became overly complex and the back testing took way too long.

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

Modular code


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Mansoor @mansoor Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by AutoStrategist
8 years, 3 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 10/27/2017
Status: Active
Attachments: 1 files
Logo Logo
Loading...