Strategyprofit Bug (doesnt work when in negative)

Forums ProRealTime English forum ProOrder support Strategyprofit Bug (doesnt work when in negative)

Viewing 12 posts - 1 through 12 (of 12 total)
  • #196211

    Hi I have been having this issue for a longtime. The result from backtest does not match the actual performance.

    I have the below code where if the Strategy profit from 10:00 am fall below 300 I would like to stop orders for the rest of the day.

    It works perfectly in the probacktest but as you can see in the below pictures: the backtest does not place order however in the reality it has placed an order.

    In the picture with the extra order (that happened in the real market)  Ihave just initiated the strategy so the “myprofit” from yesterday was “0” and when the first order is closed in loss the strategyprofit become negative and the formula will be “0- (-400) = 400 which is bigger than 300 and the system should stop for the day. My theory is that there is a bug in the Prorealtime that where the startegy profit turns negative the formula doesnot work.

    #196215

    Amin, If you try to read my comments say 5 times, you are sure I am right but that something must be wrong with my thinking. Still I am right so your code is wrong. 🙂
    Next you might be set on the wrong foot because the backtest shows that it works. But this does not tell much without the proof that the backtest did not perform other trades in advance of what you showed.

    At the bottom of your code add this line :

    And you will see where it goes off, if so. Thus, I was not saying that your statement is wrong. Only that your code is (unless I just see it wrongly).

    Additionally, it looks like you add position underway. That is a good recipe to not understand what’s happening. *And* mind you please, backtest report data deals differently with that than Live (or Demo-Live). So this confuses (just look at the number of bars of the 2nd trade and how that reports).

     

     

     

    #196221

    Hi Peter

    Thanks for your reply , This is what happened today:

    ONCE TradeOK = 1
    ONCE MyLimit = 300
    IF time = 100000 THEN
    TradeOK = 1
    Myprofit=strategyprofit // Today = 0
    ENDIF

    // Now x bars later you lost one trade and StrategyProfit = -400.

    IF (Myprofit- strategyprofit) >= MyLimit THEN

    // IF 0 -(-400) >300 then // This should return true. TradeOK = 0 // So TradeOK should be 0 and stop trading.
    ENDIF

    Not sure what you mean in your example.But  it returns False in reality . However in the backtest because the strategyprofit was in positive it work correctly.

     

    #196226

    // IF 0 -(-400) >300 then // This should return true.

    I am really sorry, but it doesn’t. -400 is smaller than +300. Not larger (>).
    🙂

    #196227

    This is the math issue in the system then because -(-400)=+400

    eg.   y= 100-x

    if x=-400 then

    y = 100 -(-400) = 100 + 400 = 500 which is > 300

    #196229

    Haha, no … you changed the code (but your last post would be correct).

    Even if I could wonder what the PRT language would do with –400 (I have not the best hopes for that turning out to be +400, you are telling the system something quite else :

    Suppose we change this

    If 0 -(-400) >300

    into this

    If 0 -(-400-200)  > … then this will work out to

    If 0- (-600) > …

    So all (ad all programming languages) anticipate that. Anticipate because it is done all over the place.
    According to you it would work out to something like

    If  0-(+400-200) =

    only because you see

    0-(-


    If I made mistakes or typos somewhere, I blame you. 🙂
    I just can’t think in explaining the obvious.

    #196230

    Your code seems to work perfectly (tested on DAX, 30-minute TF):

    #196232

    Hi Robert. My code works perfectly in backtest but in real market I have issue with negative strategyprofit. Please have a look at my screenshots that shows the backtest vs real market

    #196234
    JS

    Hi @Amin1233

    You can try this:

     

     

    1 user thanked author for this post.
    #196244
    JS

    @PeterSt

    0 – (-400) = 400

    0 – (-400) > 300  (true)

     

    #196248

    Looking for the Blush smiley !

     

    1 user thanked author for this post.
    avatar JS
    #197103

    Hi Peter, I changed it to your code and it didn’t work. Last night it happened again and after loss still opened new position. I also tried simply if strategyprofit<my profit. This one añdo didn’t work. So there is absolutely a bug here .

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

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