Can you backtest for a universe of securities?

Viewing 3 posts - 16 through 18 (of 18 total)
  • Author
    Posts
  • #175986 quote
    freecat1899freecat1899
    Participant
    Junior
    Myestimatedvol = volume*(CurrentHour-21)
    
    // Conditions to enter long positions
    c1 = close > close[1]*1.035
    c2 = close[1] <= close [2]*1.02
    c3 = close[2] <= close [3]
    c5 = average[7]/average[65]>=1.05
    c6 = Myestimatedvol>volume[1]
    IF NOT LongOnMarket AND c1  AND c2  AND c3  AND c5 AND C6 THEN
    BUY 10 CONTRACTS AT MARKET
    ENDIF
    
    // Stops and targets : Enter your protection stops and profit targets here
    SET STOP LOSS LOWEST [0]
     
    // Conditions to exit long positions
    c7 = close >= POSITIONPRICE*(1+(LOWEST[0]-POSITIONPRICE)/POSITIONPRICE)*4)
    If LongOnMarket AND c7 THEN
    SELL 5 CONTRACTS AT MARKET
    ENDIF
     
    // conditions to trail the rest
    c7 = close >= POSITIONPRICE*(1+(LOWEST[0]-POSITIONPRICE)/POSITIONPRICE)*4)
    If LongOnMarket AND c7 THEN
    SET STOP %TRAILING 5
    ENDIF
    

    I tried with your suggestions and now the first part, until “Condictions to exit long positions” seems to be fine. But I get a missing character warning first line of “conditions to exit long positions (line 17).

    The conditions for exiting the positions I want is: at 4R, close 50% of position and trail the rest either by lows of the day or 5% (the code I put is with 5%). I’m not completely suremy code is fine for this conditions, but I think it is.

    Help would be appreciated!

    Will the “Myestimatedvol” condition I added work? Is basically the same the “estimatedvolume” one does?

    #175989 quote
    JC_BywanJC_Bywan
    Moderator
    Master

    Line 17: you seem to have only 2 “(” for 3 “)”, that would be your missing character (same for line 23)

    #175990 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    There’s a missing “(“.

    I could tally 2 “(“s and 3 “)”s.

    Your Estimatedvolume is similar, though not the same, to PRT’s.

    In a 1h TF that started 10 minutes ago it should be:

    MyEstimatedVol = volume * (60/10)
Viewing 3 posts - 16 through 18 (of 18 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Can you backtest for a universe of securities?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 17 replies,
has 5 voices, and was last updated by robertogozzirobertogozzi
5 years, 1 month ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/22/2021
Status: Active
Attachments: 3 files
ProRealCode ProRealCode
Loading...