How to code? - page 185

 

Help with using EA to change Take Profit

Hi,

I currently have an EA that opens buy or sell positions every 50 pips (grid trading). Each position that is opened has a unique take profit level (TP).

Position 1 == Buy EURUSD @1.4000 with TP: 1.5000

Position 2 == Buy EURUSD @1.3950 with TP: 1.4050

What sort of programming logic can i use to write code such that:

- TP of Position 1 will be automatically changed to TP of Position 2 (when Position 2 is opened)

- If more than 2 positions are opened (e.g. 4 positions), all TP will be automatically changed to the TP of the most recent position opened (in this case Position 4)

Appreciate any advise.

 

need help on adding alert

codeguru, need your help to add sound n message alert on this indicator.

This is an zigzag indicator, i would like to add an alert when the zigzag line is formed. please help.

Files:
 

Code help anybody!!!!!!!!

Hey i need a good programmer for this new ea... I want this changes

1.i want the ea to trade when the ma's cross only and that should be the only point to enter the trade.

2. I want the ea to modify system after any pips given by me

3. Not more that trade at the entery point only

Files:
ayduct.mq4  5 kb
 

probably should post in the programming section for help

 

Hello,

I have sometimes a problem with the High_Low ZigZag Indicator which I use, if somebody can help me to slove it, I can also donate him some money with paypal if he want, because the problem annoyed me long enough.

The problem is show on the pictures wich I attached here, sometimes when I shut down my terminal and restart it then the indicator draws not correct lines first if I restart the indicator it draws again correct.

Regards

Tim

 

hello

Does anyone have a script to close positions on the open of a new bar.

cheers

Beno

 
Beno:
hello

Does anyone have a script to close positions on the open of a new bar.

cheers

Beno

You need to take a note of the time the order opened at with a code like this:

OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,StopLoss,TakeProfit,ExpertComment,MagicNumber);

OpenTradeTime = Time[0];[/PHP]

And then use this code to close the trade after 1 bar:

[PHP]OpenTradeBar = iBarShift(NULL,0,OpenTradeTime,true);

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

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderType()==OP_BUY && OrderMagicNumber() == MagicNumber && OpenTradeBar>=ExitBars && ExitBars>0)

{

OrderClose(OrderTicket(),OrderLots(),Bid,5,Yellow);

}

if(OrderType()==OP_SELL && OrderMagicNumber() == MagicNumber && OpenTradeBar>=ExitBars && ExitBars>0)

{

OrderClose(OrderTicket(),OrderLots(),Ask,5,Yellow);

}

}

 

Thanks Guru that works very well.

Could a similar script be used for the opening of a position.

Regards

Beno

 

Remote indicator control

Hi. I'm trying to use my EA to control an indicator I've written. I have exposed an extern double in the indicator which it uses on every tick to set its horizontal level. If it gets no new info in continues on its present course. I want to use the indicator as a stop out so I need the EA to be able to synchronize buy in and sell outs.

I assumed using

double somedisposedofvalue = iCustom(null, 0, "AntariesRising", [value], 0, 0);

would restart the constructor or at least update the variable, but this doesn't appear to be the case. I'm not sure if its creating an off screen instance of the indicator or its using the one I've instantiated, or if theres just another function I can call custom extern variables from.

Thanks

 

It's seem so nice to learn this thing....

Reason: