ProBacktest and drawing on the charts

Forums ProRealTime English forum ProOrder support ProBacktest and drawing on the charts

Viewing 10 posts - 1 through 10 (of 10 total)
  • #247023

    Hi there.

    I am either making a classic syntax error here or I am missing a piece of the code puzzle!….
    Backtesting only.

    I am looking for a visual line between the trade entry bar and the trade exit bar (all entered trades).
    Long trade entry/exit = green line
    Short trade entry/exit = red line
    The line needs to remain on the chart, for a visual evaluation of the backtest process.

    There are syntax errors on the DRAWSEGMENT x2 and the ENDIF !!!

    I cant see why the error occur?
    As always, any code guidance is much appreciated.

    With thanks,
    NT

    #247024

    DrawSegment is a command for an Indicator. And you apply this to Strategy Code. That implies a Syntax Error.
    Sorry …
    🙂

    2 users thanked author for this post.
    #247025
    JS

    In ProBackTest/ProOrder, graphical instructions are not allowed. For debugging purposes, you can use “Graph” (to visualize variable values in a separate window), “GraphOnPrice” (to display variable values on the price chart), and “Print” (to output variable values in a tabular format) within ProBackTest.
    When the system is uploaded to the PRT servers (Live), the entire code must be “clean” — meaning it must not include any use of “Graph”, “GraphOnPrice”, or “Print”.

    2 users thanked author for this post.
    #247056

    In ProBackTest/ProOrder, graphical instructions are not allowed….

    Hey JS, or perhaps if anyone else can assist ☺️

    Thank you very much for the clarification.

    Would you kindly show me how to add said graph text to the code, so that it displays (on the stop loss line), the level applied (as the stop loss level).
    Ideally the stop loss value would be placed on the trade entry bar (See attached with ‘*’ ).

    With thanks in anticipation.

    NT

     

    #247065

    Append these lines using GraphOnPrice to your code:

    1 user thanked author for this post.
    #247068

    // === VISUALIZATION USING DRAWSEGMENT === // Draw active stop loss lines while positions are open IF LongOnMarket THEN DRAWSEGMENT(myLongEntryBar, myLongStopLevel, BarIndex, myLongStopLevel) COLOURED(0,255,0) ENDIF   IF ShortOnMarket THEN DRAWSEGMENT(myShortEntryBar, myShortStopLevel, BarIndex, myShortStopLevel) COLOURED(255,0,0) ENDIF   // === PRINT TRADE INFORMATION ===

    Do i replace this code with yours Roberto?

    // === VISUALIZATION USING DRAWSEGMENT ===
    // Draw active stop loss lines while positions are open
    IF LongOnMarket THEN
    DRAWSEGMENT(myLongEntryBar, myLongStopLevel, BarIndex, myLongStopLevel) COLOURED(0,255,0)
    ENDIF
    IF ShortOnMarket THEN
    DRAWSEGMENT(myShortEntryBar, myShortStopLevel, BarIndex, myShortStopLevel) COLOURED(255,0,0)
    ENDIF
    // === PRINT TRADE INFORMATION ===
    Just checking, as I am not sure on the code refactoring…
    #247074

    There you go:

     

    1 user thanked author for this post.
    #247077

    // === VISUALIZATION USING DRAWSEGMENT ===

    Hey robertogozzi
    Just checking…
    The code works… but, it does not display the stop loss ‘level’, currently….

    Originally, I was asking for:

    Would you kindly show me how to add said graph text to the code, so that it displays (on the stop loss line), the stop loss level.
    Ideally the stop loss value would be placed on the trade entry bar (See attached with ‘*’ ).

    I hope that is of use, can you kindly show me the code needed to place said stop loss level.

    That would be much appreciated.

    NT

    #247083

    There no way to display text on the graph in back-test. The only way to associate text with a line is via the AS”label” command after the GRAPH variable.

    This only shows up in the cursor info box with open; close, etc.

    If the variable has a logical name like  ‘longStoploss’ then you don’t need the AS “” since the variable name is shown as default and says it all.

    1 user thanked author for this post.
    #247084

    There no way to display text on the graph in back-test….

    Hey  druby,

    Thanks for following up with this….
    I am a little confused right now, having applied the code suggested….

    The stop loss line as is, is workable (Given the backtest code limitations).

    So, I understand, you are saying, that I cannot apply the stop loss ‘level’ (value) to the chart, as per my attached image?

    The name is not needed, just the value of the stop loss level on the bar where there is a trade entry…

     

    Just when I think I am getting to understand the probacktest code, I get another curve ball lol….

    The working code is attached in txt file (which works well for coding)

    Aside, I do appreciate your follow-up help on this….

    my kindest regards,

    NT

     

Viewing 10 posts - 1 through 10 (of 10 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login