Can someone please help me with a code that can enable an ea to execute one trade per currency pair per day without constraining chart period to PERIOD_D1 and using "if(Volume[0] > 1) return(0);".
- Please help with one trade per day code
- Please help with one trade per day code
- Help with 1 trade per candle
i you find a way to make the letters even more bigger maybe someone would notice it.
if you can program show some code so we can help.
if you can't you have two possiblitys. learn to code or pay someone.
I'm feeling kind so will offer following uncompiled, untested code
static datetime lastTrade = 0; ... bool doTrade = false; if(tradeTrigger == true) { doTrade = true; // wait! do we REALLY allow trade? if(TimeCurrent() < lastTrade + 3600*24) doTrade = false; // only allow once per 24 hours if(TimeCurrent()/86400 == lastTrade/86400) doTrade = false; // only allow once per 00:00 - 23:59 period } if(doTrade) { OrderSend(...); lastTrade = TimeCurrent(); }
jeasuquo:
Can someone please help me with a code that can enable an ea to execute one trade per currency pair per day without constraining chart period to PERIOD_D1 and using "if(Volume[0] > 1) return(0);".
Can someone please help me with a code that can enable an ea to execute one trade per currency pair per day without constraining chart period to PERIOD_D1 and using "if(Volume[0] > 1) return(0);".
- Volume is unreliable (skip ticks). Bars is unreliable (stops changing at max bars in chart.) Always use Time
static datetime Time0; bool newBar = Time0 < Time[0]; if (!newBar) return(0); Time0 = Time[0];
Or iTime(NULL, PERIOD_D1, 0) instead of Time[0]
if(TimeCurrent()/86400 == lastTrade/86400) doTrade = false;
This will prevent a new trade in the same day. If you want to prevent trading for 24 hoursbool dotrade = (TimeCurrent() >= lastTrade+86400);
@brewmanz and WHRoeder: Thanks very much for your help and God bless.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register