EURGBP Trend System

Forums ProRealTime English forum ProOrder support EURGBP Trend System

Viewing 6 posts - 1 through 6 (of 6 total)
  • #51920

    Hello,

    I have the code below for a H1 EURGBP system that I’m backtesting but as you can see from the code, I only want PRT to trade within certain times. On backtesting the system keeps ignoring these times with multiple trades at 00;00,00 (midnight) which is not what I expect the code to allow. These errant trades seem to be after the system has not traded the day before (such as after the weekend). Could anyone ascertain why it is not abiding by the if time= commands?

     

    #52000

    Hi, had a quick look at this, I don’t think your code is doing what you think it is doing:

    if time=activationtime and time<limithour then

    This will only perform the tests on the following lines at 080000, I think you meant it to be between the 2 times so time >= activationtime and time<limithour?

    while case <> 0 and daytrading=1 and time <=LimitHour do
    if levelhi>0 then
        buy size contract at levelhi stop

    This will execute orders at any time before LimitHour including 000000 if it meets the entry criteria

    #52047

    Thanks autostrategist.

    I see what you mean for the first command, so the second element is correct further down under //in all cases put pending orders on market

    So this part of the code should ensure that trades are not activated beyond/past the limitHour set earlier in code?

    #52048

    Autostrategist

     

    I just tried the above and sadly the system is still taking trades at 00:00.00 (midnight) randomly. Could this be linked to this part of the code?

    It seems to take the random midnight trades when the system has not traded the day before? (such as criteria not met, or weekends)?

    #52066

    You need to change this line:

    while case <> 0 and daytrading=1 and time <=LimitHour do
    to be:

    while case <> 0 and daytrading=1 and (time >= activationtime and time <=LimitHour) do

    1 user thanked author for this post.
    #52189

    Ahh, brilliant. Thanks AS! That should solve it.

    Best wishes

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

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