fracup = NormalizeDouble(iFractals(NULL,Period(),MODE_UPPER,2),Digits); fracdown = NormalizeDouble(iFractals(NULL,Period(),MODE_LOWER,2),Digits);Try using a shift of 2
According to the definition of a fractal (or this particular "fractal") you need to have 1 peak bar followed by 2 bars that are lower (or higher). thats why you can never have a "fractal" at the previous bar, you need at least 2 more bars after the "fractal" bar...therefore your shift needs to be bigger...
thank you
Automated
--
grid trading EA, +558 pips in 24 hours:
http://grid9.forexmosaic.com/ - 8621 pips in 7 weeks of grid trading

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
I want to use iFractals and I have a trouble. Actually it always return the value 0.000 I was wondering if someone has already used it in his code and explain why it does not work.
Here is the code :
total = OrdersTotal();
if(total<1)//fix the nb of trade to 1
{
if(prevtime==Time[0])
return(0);
prevtime=Time[0];
RefreshRates();
sig_buy=iCustom(NULL,0,VQname,false,Period(),Length,Method,Smoothing,Filter,true,false,Color,Alerts,EmailON,SignalPrice,SignalPriceBUY,SignalPriceSELL,CountBars,3,1); //compute VQ signal
sig_sell=iCustom(NULL,0,VQname,false,Period(),Length,Method,Smoothing,Filter,true,false,Color,Alerts,EmailON,SignalPrice,SignalPriceBUY,SignalPriceSELL,CountBars,4,1);
double sig_buy1=iCustom(NULL,0,VQname,false,PERIOD_H1,Length,Method,Smoothing,Filter,true,false,Color,Alerts,EmailON,SignalPrice,SignalPriceBUY,SignalPriceSELL,CountBars,3,1); //compute VQ signal
double sig_sell1=iCustom(NULL,0,VQname,false,PERIOD_H1,Length,Method,Smoothing,Filter,true,false,Color,Alerts,EmailON,SignalPrice,SignalPriceBUY,SignalPriceSELL,CountBars,4,1);
ma = iMA(NULL,Period(),50,MAshift,MODE_SMA,PRICE_CLOSE,1);
double ma100 = iMA(NULL,Period(),100,MAshift,MODE_SMA,PRICE_CLOSE,0);
double ma200 = iMA(NULL,Period(),50,MAshift,MODE_SMA,PRICE_CLOSE,0);
fracup = NormalizeDouble(iFractals(NULL,Period(),MODE_UPPER,1),Digits);
fracdown = NormalizeDouble(iFractals(NULL,Period(),MODE_LOWER,1),Digits);
if(sig_buy>0&&sig_buy<EMPTY_VALUE&&sig_buy1>0&&Ask>=ma100&&ma>ma100&&fracup==0)
{
atr =iATR(NULL,Period(),20,0);
SL = ma100;
delta = NormalizeDouble(Ask-SL,Digits);
if(delta<=200.0*Point)
{
Print("SL<=20 pips");
return(0);
}
else{
ticket = OrderSend(Symbol(),OP_BUY,Lots,Ask,3,SL,0,"Buy order",magic,0,Blue);
if(ticket<=0)
{
Print("Error cannot open the buy order : "+GetLastError());
return(0);
}
else
{
OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES);
Print("Buy order open : "+OrderOpenPrice()+" FRactalup "+fracup+" fracsown "+fracdown+" MA = "+ma);
}
}
}
.....
The code continue but but when I print the value of the ifractals i have always zero (note I have defined fracup and fracdown outside the block and I used double)
Any comments are welcome. Thanks