I'm still trying to decipher all of this code and I have to admit it has been overwhelming.
In regards to the DST adjustment I wrote a strategy that uses a specific time of day waiting for a breakout to occur. When I went to optimize the strategy to determine what the best time was I noticed mixed results as my statistics did not accomodate for any type of DST adjustment. Once I wrote the code in the previous post my results increased significantly.
The problem I see here with your optimization is you are looking for the best hour(from what I can tell so far) to trade breakout or reverse. However, if the NY markets open at 8AM for half the year and 7AM the other half then your backtest results are going to mix up 8AM and 7AM statistics. However, I do suppose if you are only optimizing your data say for a week at a time then this point becomes moot. While two weeks out of the year might be off the rest will be fine. In my instance I was testing data for years at a time so it made a significant difference.
As far as using multiple MA's my thought process is as follows:
for(MA1=0;MA1<StopMA;MA1++){
for(x=BarsBack;BarsBack>0;BarsBack--){
if(!VirtualLong && if MA1[x] > MA1[x+1]){
VirtualLong=true;
VirtualLongEntry=Ask[x];
VirtualStopLoss=Ask[x]-inputStopLoss;
VirtualTakeProfit=Ask[x]+inputTakeProfit;
}
if(VirtualLong){
if(High[x]>VirtualTakeProfit && Low[x] > VirtualStopLoss){
MA1Win++;
VirtualLong=false;
VirtualLongEntry=0;
VirtualStopLoss=0;
VirtualTakeProfit=0;
}
if(Low[x]<VirtualStopLoss && High[x] < VirtualTakeProfit){
MA1Loss++;
VirtualLong=false;
VirtualLongEntry=0;
VirtualStopLoss=0;
VirtualTakeProfit=0;
}
if(High[x]>VirtualTakeProfit && Low[x]<VirtualStopLoss){
Print("Could not determine win or loss);
VirtualLong=false;
VirtualLongEntry=0;
VirtualStopLoss=0;
VirtualTakeProfit=0;
}
}
}
}
This is my crude approach I just typed up as an example and obviously is no where near completion.
In regards to the DST adjustment I wrote a strategy that uses a specific time of day waiting for a breakout to occur. When I went to optimize the strategy to determine what the best time was I noticed mixed results as my statistics did not accomodate for any type of DST adjustment. Once I wrote the code in the previous post my results increased significantly.
The problem I see here with your optimization is you are looking for the best hour(from what I can tell so far) to trade breakout or reverse. However, if the NY markets open at 8AM for half the year and 7AM the other half then your backtest results are going to mix up 8AM and 7AM statistics. However, I do suppose if you are only optimizing your data say for a week at a time then this point becomes moot. While two weeks out of the year might be off the rest will be fine. In my instance I was testing data for years at a time so it made a significant difference.
As far as using multiple MA's my thought process is as follows:
for(MA1=0;MA1<StopMA;MA1++){
for(x=BarsBack;BarsBack>0;BarsBack--){
if(!VirtualLong && if MA1[x] > MA1[x+1]){
VirtualLong=true;
VirtualLongEntry=Ask[x];
VirtualStopLoss=Ask[x]-inputStopLoss;
VirtualTakeProfit=Ask[x]+inputTakeProfit;
}
if(VirtualLong){
if(High[x]>VirtualTakeProfit && Low[x] > VirtualStopLoss){
MA1Win++;
VirtualLong=false;
VirtualLongEntry=0;
VirtualStopLoss=0;
VirtualTakeProfit=0;
}
if(Low[x]<VirtualStopLoss && High[x] < VirtualTakeProfit){
MA1Loss++;
VirtualLong=false;
VirtualLongEntry=0;
VirtualStopLoss=0;
VirtualTakeProfit=0;
}
if(High[x]>VirtualTakeProfit && Low[x]<VirtualStopLoss){
Print("Could not determine win or loss);
VirtualLong=false;
VirtualLongEntry=0;
VirtualStopLoss=0;
VirtualTakeProfit=0;
}
}
}
}
This is my crude approach I just typed up as an example and obviously is no where near completion.
DislikedI agree DST adjusted data is better.
Problem becomes how do I account for the two 2:00AMs and the lack of a 2:00AM twice a year?
For now, I've avoided that issue by simply using relatively small backtesting periods.
DST shifts tend to affect the markets for a week--two at most. I suspect this is driven mostly by the new sleep schedule traders need to accommodate. I would like to learn what advantages and opportunities you're seeing with DST-adjusted data.
I was hoping to use the law of large numbers to my advantage in this EA concept....Ignored