Back testing strategies

Forums ProRealTime English forum ProOrder support Back testing strategies

Viewing 15 posts - 46 through 60 (of 104 total)
  • #74409

    It is saying syntax error

    this variable is not used in the code: maxbars

    the following variable is undefined: maxdays

     

    #74420

    I got it to work.

    On the time code you gave me this suggests to only enter trades between 8am and 1pm, is this correct? If so how do I get it to work to only place trades between 11pm and 7am which is the NYE market for me in Australia?

     

    #74432

     

    #74440

    It is saying syntax error

    Sorry – my fault. I put MaxDays instead of MaxBars (I usually trade daily charts so use the MaxDays as a name but changed it to MaxBars for you but I missed one of them! I edited my post moments later but you were obviously too quick!

    #74441

    If so how do I get it to work to only place trades between 11pm and 7am which is the NYE market for me in Australia?

    I just used those times as an example as you did not say what times you actually wanted. Time is in HHMMSS. So 130000 is 13Hr 0Min 0Sec and 144859 is 14Hr 48Min 59Sec. But you should be aware that the latter time does not actually exist in bar form on anything but second time frame charts.

    #74464

    Ok so when I use the above code I get no trades. I think it has to do with the start and end times?

    But when I use the above code I get lots of entries?

    #74472

    starttime = 230000 endtime = 070000 timeok = opentime >= starttime and opentime <= endtime Ok so when I use the above code I get no trades. I think it has to do with the start and end times?

    For me in the UK on GMT,  starttime = 230000 endtime = 070000 is out of hours for USA Market.

    You are GMT + 10 in Australia soooo, 🙂 oh it’s too early and the coffee has not woke my brain up yet, but you can see where I am coming from???

    Use the link below to work out you have the correct times in your code for USA Market open in relation to the time standard you have set on your Platform etc?

    https://www.worldtimezone.com/markets24.php

    #74475

    It is because you have your start time as a higher number than your endtime. If you want to straddle midnight then you have to change the AND to an OR

     

    1 user thanked author for this post.
    #74484

    Ok will make these changes.

    #74664

    The above code wipes out my account balance and incurs losses of say $45k. So why if I reverse the buy and sell entries it does not produce the same level of profit being $45k?

    #74674

    I have not tested it but I would guess it is because bad entries coupled with bad exits do not change just because you are selling instead of buying.

    I notice that you have the calculation for ‘myatr’ after you first use the variable myatr in the code so for the first bar myatr will equal zero until line 30 is first read. You should move it to higher to above line 12 at least.

    #74675

    I also notice that you are not testing with level stakes. Take out the money management until you know that you have a strategy that can win at a level stake of 1 and then see if you can improve it with the ATR based position sizing once you know your idea works. You are just muddying the water of your analysis of whether the basic idea works by including money management from the start.

    It might also be useful for others to know what market and what time frame you are testing on.

    #74676

    I had no idea the line in which you entered the code had any effect on the calculation – THANK YOU, I will bring up to above line 12.

     

    #74677

    I will also remove the atr based stop for now.

    I think this is why I am pulling my hair out. I am trying to develop a strategy at first with too many conditions. Do you suggest keep it basic and then add conditions?

    #74678

    I keep it very basic. If I can’t describe my strategy theory in one sentence then the idea is too complicated.

    My best strategies might start off with just ten lines of code (maybe more if I am including the code from a home made indicator within the strategy). I analyse the output then optimize one thing at a time and re-analyse, then I start taking things out to see how important they are to the decision making process – the more conditions the more likely it is to be curve fitted. Every fixed variable is a potential curve fit – every single one must be analysed to compare with values either side of it.  It is not until I am happy that my basic idea has been analysed to within an inch of its life that I will start thinking about money management or variable position sizing. Then I will forward test it in demo for a few months to decide if it really is something I want to risk actual money on.

    The final strategy might be 100 lines of code but 90 of that will be money management options and 10 lines the actual strategy!

    Others might do it differently but that is my method and philosophy on strategy coding.

    1 user thanked author for this post.
Viewing 15 posts - 46 through 60 (of 104 total)

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