Trailing produce many even trades

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #70114 quote
    AbzAbz
    Participant
    Veteran

    Hello,

    i am trying to use the attached code for backtesting strategies and it produces a lot of “EVEN” trades this only happens if i run it on prorealtime if i run prorealtime trough IG it does not happen. Anyone why this happens?

     

    ////trailing stop function
    trailingstart = 3 //trailing will start @trailinstart points profit 25
    trailingstep = 1 //trailing step to move the "stoploss" 30 21 & 9
    slDistance = 0.6 // <--- to compensate for SL distance reqs emposed by the dealer.
     
    //reset the stoploss value
    IF NOT ONMARKET THEN
    newSL=0
    ENDIF
     
    //manage long positions
    IF LONGONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
    newSL = tradeprice(1)+trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>=trailingstep*pipsize+slDistance THEN
    newSL = newSL+trailingstep*pipsize
    ENDIF
    ENDIF
     
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
    newSL = tradeprice(1)-trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>=trailingstep*pipsize+slDistance THEN
    newSL = newSL-trailingstep*pipsize
    ENDIF
    ENDIF
     
    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    
    
    set stop ploss 5
    #70115 quote
    AbzAbz
    Participant
    Veteran

    *solved*

    instead of using pipsize i used pointsize then it worked

    GraHal thanked this post
    #70124 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Are you sure you didn’t change anything else?

    Because PointSize and PipSize are two different names for the same thing, as from language doc https://www.prorealcode.com/documentation/pipsize/.

    Indeed a tried a simple debugging strategy and, despite I wanted to GRAPH both, ProOrder displayed only one of them (the same is true for PipValue and PointValue as well).

    x-1.jpg x-1.jpg
    #70144 quote
    AbzAbz
    Participant
    Veteran

    i only changed that and the backtest worked prfectly

    #70155 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Well, then there must be a bug either in the DOC or in ProOrder!

Viewing 5 posts - 1 through 5 (of 5 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

Trailing produce many even trades


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Abz @abbas_sadiq Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/09/2018
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...