Remove date from test

Back to topics list To post a new topic, please log in or register
avatar
181
gangsta1 2016.04.09 00:02
 
I am testing a CHF based strategy but the CHF peg in early 2015 is causing irrational results so I was wondering if it is possible to code something that will prevent the strategy from trading on this date?
avatar
69
Tecuciztecatl 2016.04.09 00:13 #
 
if (TimeCurrent()>=StrToTime("2015.01.15 00:00") && TimeCurrent()<=StrToTime("2015.01.15 23:59")) return;

avatar
181
gangsta1 2016.04.09 00:53 #
 
Tecuciztecatl:

Thank you, I will give that I try. Just need to find a place for it in my code now.
avatar
69
Tecuciztecatl 2016.04.09 11:36 #
 
...in the first line of the function OnTick or OnTimer (or wherever you have a main loop EA)
avatar
181
gangsta1 2016.04.09 12:56 #
 
Tecuciztecatl:
...in the first line of the function OnTick or OnTimer (or wherever you have a main loop EA)
void OnEveryTick1()
{
    if (true == false && false) PipValue = 10;
    if (true && (NDigits == 3 || NDigits == 5)) PipValue = 10;
    if (TimeCurrent()>=StrToTime("2015.01.15 00:00") && TimeCurrent()<=StrToTime("2015.01.15 23:59")) return;
    { 
    FilterBuy();
    FilterSell();
    }
}
This worked perfectly, thank you!
avatar
Moderator
3427
GumRai 2016.04.09 13:15 #
 
gangsta1:
This worked perfectly, thank you!

Except

if (true == false)

will never be true

avatar
13009
WHRoeder 2016.04.09 16:47 #
 
gangsta1: I am testing a CHF based strategy but the CHF peg in early 2015 is causing irrational results so I was wondering if it is possible to code something that will prevent the strategy from trading on this date?
Instead of kludging your EA, just remove the day from your history. Done.
Back to topics list  

To add comments, please log in or register