How to code? - page 184

 

Helping make indicators to ea

A great strategy found by me many pips waiting

HELLO EVERYONE I FOUND OUT A STRATEGIES ON ALL CURRENCY AND I NEED YOU TO MAKE THE EA FOR ME CHECK THIS OUT...

1 MA_Period= 2 MA_shift= -5 MA_Method= 3 (YELLOW)

2 MA settings MA_Period= 4 MA_shift= -5 MA_Method= 3 (RED)

3 MA settings MA_Period= 200 MA_shift= 0 MA_Method= 0 (COLOUR TEAL)

SIGNAL SHORT: WHEN YELLOW AND RED CROSSING TEAL EITHER UP OR DOWN

LETS DO SOME EA TO MAKE IT WORKS AND LETS MAKE THE EA MODIFIED ITSELF WHEN PRICE MOVE TO 10 PIPS NO THE STOP LOSS WILL MOVE TO 2 PIPS WAITING FOR THE BEST PROGRAMMER....

 
 

Need help with programming monitor price

hello everyone, I had a question about programming on the MT4, how would I be able to make the EA to monitor the price? such as, if the price goes up to certain level, then it will initial another set of orders? I had enclose my EA code here , much thanks for the help

//+------------------------------------------------------------------+

//| Auto Pipforia.mq4 |

//| Copyright ?2009, MetaQuotes Software Corp. |

//| Forex Trading Software: Forex Trading Platform MetaTrader 4 |

//+------------------------------------------------------------------+

extern double AnchorSpace = 0.0017;

extern double GridSpace = 0.0017;

extern double AnchorLot = 0.03;

extern double Level1 = 0.06;

extern double Level2 = 0.11;

extern double Level3 = 0.11;

extern double Level4Up = 0.11;

extern int MagicNumber = 1001;

extern double Profit_Target=0;

double SendCount=0;

int start()

{

int divider=(Ask-Bid)/2;

double MidPrice=Ask-divider;

double Buy=MidPrice+AnchorSpace;

SendOrders(Buy);

MonitorProfit();

return(0);

}

//+------------------------------------------------------------------+

//+------------------------------------------------------------------+

void SendOrders(double Buy)

{

if(SendCount<3){

OrderSend(Symbol(),OP_BUYSTOP,AnchorLot,Buy,0,0,0,"MagicNumber",MagicNumber,0,Green);

Buy=Buy+GridSpace;

OrderSend(Symbol(),OP_BUYSTOP,Level1,Buy,0,0,0,"MagicNumber",MagicNumber,0,Green);

Buy=Buy+GridSpace;

OrderSend(Symbol(),OP_BUYSTOP,Level2,Buy,0,0,0,"MagicNumber",MagicNumber,0,Green);

SendCount=3;

}

else if (SendCount==3)

{

return();

}

}

//+------------------------------------------------------------------+

void MonitorProfit()

{

// double Percent=Profit_Percentage/100;

int total = OrdersTotal();

double MyCurrentProfit=0;

for (int cnt = 0 ; cnt < total ; cnt++)

{

OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);

if (OrderMagicNumber() == MagicNumber)

MyCurrentProfit += OrderProfit();

}

if (MyCurrentProfit>= Profit_Target){

for(int i=total-1;i>=0;i--)

{

OrderSelect(i, SELECT_BY_POS);

if (OrderMagicNumber() == MagicNumber)

{

OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(),()), 5, Red );

OrderDelete( OrderTicket() );

}

}

}

else()

{

return();

}

}

//here is the part need to be programmed.

//+------------------------------------------------------------------+

void MonitorPrice()

{

if(Buy-Ask<=20 Point || Bid-Sell<=20 Point)

{

 

To tendyhk-

your Q is not entirely clear, but '20 Point' should read '20*Point'.

Big Be

 

To Kimito2

I believe that can be done and I believe I can do it. Most of the tasks I have already in my own lengthy EA. It won't be cheap because I value my time.

Big Be

 

how to make a trade with a cycle?

hi

I have an EA and I'd like to make it works with a cycle.

I've got 5 variables

double ma1 = iMA(NULL, 0, 1, 0, MODE_EMA, PRICE_CLOSE, Current + 0);

double sar = iSAR(NULL, 0, 0.02, 0.2, Current + 0);

double Macd=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,Current + 0);

double Signal=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,Current + 0);

string var_trading="ok";

the conditon for a trade is :

******************************

if (Period()==1)

{

double ma_buy = ma1>sar && Macd>Signal && var_trading=="ok" ;

}

******************************

And this is what i want :

1/the trade beginning

2/the value for var_trading became "no" --> var_trading="no"

3/ End of the trade (Takeprofit or stoploss)

4/The new trade can begin because var_trading=="no"

5/ IMPORTANT : when ma1 var_trading=="ok"

6/ When ma1 > sar again and if Macd>Signal ====> a new trade beginning!

7/ and the value for var_trading became "no" --> var_trading="no"

8/ etc....

*******************************

How can I do?

For many reasons, I don' want this (see my code please)

double ma_buy = ma1p1sar && Macd>Signal && var_trading=="ok" ;

Best regards

Files:
thl.mq4  22 kb
 

Programmers pls help me on this

I am trying to convert a indicator into EA. Indicator is using "int counted_bars = IndicatorCounted()", for counting bars, in EA I think I can't use this since it related to indicator.

How could I fix this problem.

Your help will be appreciated

Thanks

 

If you want to use an indicator in an EA the best/easiest way is to use the iCustom function. Take a look in the help file for it's use.

Good luck

Lux

 

@luxinterior, thanks for your reply

 

i was given this errors what is that meanS?

2009.06.16 08:23:11 TestGenerator: unmatched data error (volume limit 66 at 2009.06.15 20:45 exceeded)