Using Fractals in an EA

 

Pls I'm presently faced with a problem, and that's using the Bill Williams indicator( Fractals)

here's the code pls direct me.

// initializations

double fraCurrent, fraPrevious;


//Calculate indicators' value

// Fractal Current
fraCurrent = iFractals(NULL, 0, MODE ?, 0); original statement: iFractals( string symbol, int timeframe, int mode, int shift );

// Fractal Previous
fraPrevious = iFractals(NULL, 0, MODE?, 1);


// Check for BUY, SELL, and CLOSE signal

isBuying = (fraCurrent <= Ask && fraPrevious>fraCurrent );

isSelling = (fraCurrent >= Bid && fraPrevious<fraCurrent );

isClosing = false;


I've tried everything, though new to this language, but a C# programmer, I need your assistance. Thanks!

 

Oka

This will get you started


//============================================================

int ticket;
double f;
double g;

f=iFractals("GBPUSD",PERIOD_H4,MODE_UPPER,1);
g=iFractals("GBPUSD",PERIOD_H4,MODE_LOWER,1);


if(f!=0)
{
ticket=OrderSend("GBPUSD",OP_BUY,1,Ask,5,Ask-10*Point,Ask+20*Point,"My buy order #2",16384,0,Green);
}


if(g!=0)
{
ticket=OrderSend("GBPUSD",OP_SELL,1,Bid,5,Bid+10*Point,Bid-20*Point,"My sell order #2",16384,0,Red);
}
//----
return(0);
}

//============================================================


IMHO

Fractals look great on a chart - on past bars (cos they are <always> right)

BUT

in live trade they <change their minds> during the formation of the current candle and often the following candle :eek:

So, to me, they are too laggy for EA use.

They are of interest as confirmation in a conservative position trading system - but probably are no better than SAR for this :(


What were you after exactly - how does fractals fit your planned system?

My 2c worth ;)


BB

 

Thanks Alot BB, your solution works,

...Concerning what I'm up to,

well I've tried my hand on other EA's but none seems appropriate enough

I traditionally trade on the long term, but after been introduced to this platform I've had hurdles

creating an expert, all on my own, studied other experts posted on the site, none seem effective

enough for a small account. pls I'll need some professional help, sitting in front of the screen

can be a terrible bore. OkaforIk


well I figured out delaying the time of buy by some few secs could proove useful,

by then we'll know the true trend, I did a survey on usdcad 15 mins and found out that on

the av. 10 out of a range of 12 to 15 moves are always right, taking aprofit of at least 7 pips

now the good thing is when you modify your lot, have to go now will get to talk with you later