Download MetaTrader 5

Remove date from test

To add comments, please log in or register
gangsta1
1197
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?
Tecuciztecatl
70
Tecuciztecatl  
if (TimeCurrent()>=StrToTime("2015.01.15 00:00") && TimeCurrent()<=StrToTime("2015.01.15 23:59")) return;
gangsta1
1197
gangsta1  
Tecuciztecatl:

Thank you, I will give that I try. Just need to find a place for it in my code now.
Tecuciztecatl
70
Tecuciztecatl  
...in the first line of the function OnTick or OnTimer (or wherever you have a main loop EA)
gangsta1
1197
gangsta1  
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!
Keith Watford
Moderator
10568
Keith Watford  
gangsta1:
This worked perfectly, thank you!

Except

if (true == false)

will never be true

whroeder1
15572
whroeder1  
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.
To add comments, please log in or register