Backtest works fine.when i do forward test not working.
Instead of Day() try TimeDay(TimeCurrent())
Is nday static ?
Instead of Day() try TimeDay(TimeCurrent())
Is nday static ?
not static. i declared global
int nday=0;
not static. i declared global
int nday=0;
OK, global scope == static
I wonder that i didnt do anything, but now works fine!...
I wonder that i didnt do anything, but now works fine!...
Obviously not, if you changed nothing and it didn't work before it is not working correctly now . . . it may for some time but won't be correct.
Did you try "Instead of Day() try TimeDay(TimeCurrent())" ?
Obviously not, if you changed nothing and it didn't work before it is not working correctly now . . . it may for some time but won't be correct.
Did you try "Instead of Day() try TimeDay(TimeCurrent())" ?
Thank you for your support. i try following code as per your advice.
Is this correct what i am trying?
int nday=0; if nday!=TimeDay(TimeCurrent()); return(true); <--Code--> nday=TimeDay(TimeCurrent());
Thank you for your support. i try following code as per your advice.
Is this correct what i am trying?
You don't have return(true); in the code you posted earlier . . . just replace Day() with TimeDay(TimeCurrent()) . . . nothing else, one change at a time, then test . . .
Here it is. is this correct one i am using!
{
if (nday != TimeDay(TimeCurrent()))
{
Details();
}
}
void Details()
{
some_time=iTime(NULL, PERIOD_D1, 0);
shift=iBarShift(NULL,0,some_time);
Hval=iHigh(NULL,0,shift);
Lval=iLow(NULL,0,shift);
Cval=iClose(NULL,0,shift);
HLdiff=Hval-Lval;
Percent=HLdiff*0.25;
BuyNow=Cval+Percent;
SellNow=Cval-Percent;
bTP=BuyNow+Percent;
sTP=SellNow-Percent;
bSL=SellNow+0.10;
sSL=BuyNow-0.10;
Comment("High: ",Hval,"Low: ",Lval,"Close: ",Cval,"Diff: ",HLdiff,"Percent: ",Percent,"Buy: ",BuyNow,"Sell: ",SellNow,"BuyTP: ",bTP,"SellTP: ",sTP,"BuySL: ",bSL,"SellSL: ",sSL,"Day: ",nday);
}
Here it is. is this correct one i am using!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I used following code/idea to apply 1 trade/day. last 20days it was worked. but since today not working. may be my logic will be wrong.
I assign the int value 0 to nday
and process orders if nday!=Day()
once prcess done i change the value for nday=Day()
is this ok. but not working now.
{ if (nday != Day()) { #define ZEROAM 00 #define THREEAM 03 threeAM=0; while( TimeHour(Time[threeAM]) != THREEAM ) threeAM++; High0To3 = High[iHighest(NULL,0,MODE_HIGH, THREEAM-ZEROAM+1,threeAM)]; Low0To3 = Low[iLowest(NULL,0,MODE_LOW, THREEAM-ZEROAM+1,threeAM)]; HLdiff=High0To3-Low0To3; } } nday=Day()