Download MetaTrader 5
To add comments, please log in or register
All Code Base apps are available from MetaTrader 5. You can publish your own one!
gangsta1
1117
gangsta1 2016.04.08 22: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?
Tecuciztecatl
70
Tecuciztecatl 2016.04.08 22:13  
if (TimeCurrent()>=StrToTime("2015.01.15 00:00") && TimeCurrent()<=StrToTime("2015.01.15 23:59")) return;
gangsta1
1117
gangsta1 2016.04.08 22:53  
Tecuciztecatl:

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

Except

if (true == false)

will never be true

whroeder1
13959
whroeder1 2016.04.09 14: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.
/
To add comments, please log in or register