one to one coaching

Some help coding whipsaw filter appreciated

maximo

Member
Hiya!

I would like some code snippet for detecting 2 consecutive losses on the same day from Historical trades and then use a Time based delay before it resumes trading. eg. wait 400 mins.

This is for an EA I'm coding using CCI on 5 min chart. It's not usual to have whipsaws with my system, but filtering them out would make a good system better.

Thanks for any help you may give.


P.S. I have some code that looks at past trades from trade history, but with more than 1 robot running this can present problems. How many trades to look back etc. So I think I will go with setting 3 global variables like this.

SystemName_TradeLoss_1_MON_8:25
SystemName_TradeLoss_2_MON_9:15
SystemName_TradeLoss_delay_400; //In minutes after 2 losses

The globals will get deleted once the time is up, then trading will resume.

Setting globals should eliminate variables getting cleared if there is a disconnect, restart, reset.
 

Attachments

stovedude

Active member
I just now found this thread. I guess I missed it. That's why I created the Wish List threads. I'm not sure that you need globals. I think all you need is a function to check the lost trades for the day for that particular bot and then the 400 min can be calculated from the last trade's OrderCloseTime() as a another function. This can be called on every tick or just at a specific time when the last trade is closed (better).
 
one to one coaching
Top