indicator to ea

 

i was thinking over the last week the startegy i use works, it needs a little speeding up, click click click takes toe long - i have over the weekend decided to also add another indicator to my list of signals to trade.

I started writing an EA, i use a custom indicator that draws two lines and then an arrow if the lines cross and the candle is complete in that direction.

my problem is that i need to get the results of the indicator to my EA, seen what most people did but i dont understand one thing

When NINA (my one indicator not my gf) shows me an up arrow i display a message Buy or down would be sell, this works becuase of the alert

the iCustom= (blah blah,"NINA",blah blah ) when i add this to me EA i get nothing, Is there a place that could explain what each thing in that string means.

I have two lets say "declared variables" (i code VB/PHP/ASP sorry for terms used) that the NINA gives back to me like this:

 if(nina_position<0)

{
Alert ("Sell");

}

if(nina_position>0)
{

Alert ("Buy");

}

and thats the time the EA shloud fire the comman

if the signal is buy then ....

OrderSend(Symbol(),OP_BUY,0.1,Ask,10,Ask-2000*Point,Ask+30*Point,"Buy Order",16384,0,Green);

for sell the same thing ... my EA works on Williams Indicator but i want to add custom indicator to it, beware dont just use code below it is work in progress..

//AGIOFIN 2011 - COPYRIGHT TO ME MEANS YOU HAVE RIGHT TO COPY  SO GO AHEAD AND USE WHATEVER YOU WANT!
//USE THE WILLIAMS INDICATOR

//SET AND GET WILIAMS PARAM.
extern int WPRSIperiod =27;
extern int WRhigh=-20;
extern int WRlow=-80;
double WR1,WR2;

//=========================================
int init()
{
return(0);
}


//=========================================
int deinit()
{
return(0);
}
//=========================================

int start()
{
int limit;

//VARIABLE COUNT - FOR LOOP
for(int i=1; i < limit; i++)
//VARIABLE FOR NUMBER OF ORDERS
int total = OrdersTotal();

WR1=iWPR(NULL,0,WPRSIperiod,0);
WR2=iWPR(NULL,0,WPRSIperiod,1);
Comment(" WILLIAM'S %R (",WPRSIperiod,") = ",WR1,"\n",
" BUY OVER = ",WRhigh,"\n",
" SELL UNDER = ",WRlow,"\n",
" EXIT AT -50 ");

//===================================================
//BUY ORDER CODE HERE
//===================================================

//IF ORDERS LESS THAN 5
if (OrdersTotal() < 5)

//THEN

//IF TIME IS BIGGER THAN 0:00 LESS THAN 23:00
if(Hour() > 0 && Hour() < 23) //TRADE BETWEEN THESE HOURS

//CHECK VALUES AND IF TRUE RUN CODE
if(WR1 > WRhigh && WR2 < WRhigh)

OrderSend(Symbol(),OP_BUY,0.1,Ask,10,Ask-200*Point,Ask+30*Point,"Open a Buy Order",16384,0,Green);

//===================================================
//SELL ORDER CODE HERE
//===================================================

//IF ORDERS LESS THAN 5
if (OrdersTotal() < 5)

//THEN

//IF TIME IS BIGGER THAN 0:00 LESS THAN 23:00
if(Hour() > 0 && Hour() < 23) //TRADE BETWEEN THESE HOURS

//THEN

//CHECK VALUES AND IF TRUE RUN CODE
if(WR1 WRlow )

OrderSend(Symbol(),OP_SELL,0.1,Bid,10,Bid+30*Point,Bid-200*Point,"SELL",16384,0,Red);

}
//===================================================

any help or point to where the help is would be much appreciated

Thanks for a great forum ! you guys rock !

 

for first question that might be icustom problem.

search Grabbuffer.mq4 on google you should able to find.

 
mtuppers:
for first question that might be icustom problem.search Grabbuffer.mq4 on google you should able to find.

WOW never knew this was possible ..

I coded it into my Semi Automated EA and it works, one problem though there are two arrows in the custom indicator that does not show up in the buffer, will have to find a way to let the EA know when lines cross, the trend has changed and must close open order and open order in direction of the arrow.

still scratching me head on that one but thanks for the direction you pointed me into it was a huge jump forward

 

The inicator has twop linbe and i get those values from the buffer

Red and green

If red is less than green it is a sell, if green is less than red its buy

During the drawing they eventually cross each other

was thinking in the VB way of doing it:

Declare few variables like:

CurrentTrend=""

OrderTrend = ""

DownTrend = Down

Uptrend = Up

When lines cross (either red less than green OR green less than red ) check if the current is set to either Up or Down

If it has no value then set it to Up or Down because the user probably just opened the MT4 so it has no value yet ... it waits for lines to cross then assigns value of Up or down, then starts trading

If the Order trend is same as Current trend then do nothing (that shows lines have not crossed yet) if it is different close ticket and open new order in direction of CurrentTrend

to set order trend it should use if red less than green or green less than red

something like that ...