How to code? - page 264

 
 
 

BullsPeriod indi

Here is another solution - study the changes and your mistakes.

Not sure what you want to end up with, but this works.

Big Be

Files:
bulls_ma2.mq4  4 kb
 

To Sapere

Sapere,

Look up iBands in the metaeditor navigator. Mode is the buffer number you want, 1 for upper in your case.

Bars is the number of bars on the chart.

Study similar indicators or EAs.

Big Be

 

Modify and indicator

The Bulls_MA was just what I was looking for. It shows a line for the moving average There was no line with Bull_MA2. I will study both the changes as I'd like to improve my skills here.

Many many thanks for this help. Is really appreciated.

 

Here is a solution as well.

It allows for any of the 4 MA modes available in MT4.

I also added clear labels for the MA line and removed the properties for limits.

Those caused the histogram to be very small.

Robert Hill aka MrPip

Files:
bullsma.mq4  4 kb
 

Need Simple Piece of Code

Hey People, Please help me out if you can.

I have trying to find something coded, but cant,

I want My EA to increase lot size every XXX amout of trades, How can I do this?

Thanks,

 

MA Indicator

Thanks MrPip for your work on this indicator. I appreciate and I learn.

 

EA mixing BUY and SELL orders

Hi,

I'm trying to code an EA and at some place in my code I've to update the stoploss of opened and pending orders. I'm displaying an alert with the informations about the order.

When I run it, I receive a message like: "Count: 2 Stoploss 1.44705 for buy order: 46450421 orderType: 1".

orderType: 1 means that order 46450421 is a OP_SELL order, which it is, but why is it triggering the test "if ((orderType == OP_BUY || orderType == OP_BUYSTOP))" instead of "if ((orderType == OP_SELL || orderType == OP_SELLSTOP))"?

int orderType;

for(cnt = total-1; cnt >= 0; cnt--)

{

while (!OrderSelect(cnt, SELECT_BY_POS)) {Sleep(500);}

orderType = OrderType();

if(/*OrderMagicNumber()==Magic &&*/ OrderSymbol()==Symbol())

{

if ((orderType == OP_BUY || orderType == OP_BUYSTOP)) {

if (NormalizeDouble(OrderStopLoss(), Digits) != longSL) {

if (Debug) {

Alert("LongSL: " + longSL);

Alert("Order SL: " + NormalizeDouble(OrderStopLoss(), Digits));

Alert("Modif required");

Alert("Count: " + cnt + " Stoploss " + longSL + " for buy order: " + OrderTicket() + " orderType: " +OrderType());

}

OrderModify(OrderTicket(), OrderOpenPrice(), longSL, OrderTakeProfit(),0, Yellow);

}

}

if ((orderType == OP_SELL || orderType == OP_SELLSTOP)) {

if (NormalizeDouble(OrderStopLoss(), Digits) != shortSL) {

if (Debug) {

Alert("ShortSL: " + shortSL);

Alert("Order SL: " + NormalizeDouble(OrderStopLoss(), Digits));

Alert("Modif required");

Alert("Count: " + cnt + " Stoploss " + shortSL + " for sell order: " + OrderTicket() + " orderType: " +OrderType());

}

OrderModify(OrderTicket(), OrderOpenPrice(), shortSL, OrderTakeProfit(),0, Yellow);

}

}

} // end of if

} // end of for

Please help :-)

Daniel

 

Need to change from current price to Daily High Low alert

I have this good price alert mq4 and I need to change it from target price to Today Daily High Low & having difficulty to modify it because I could not move Price1 to int Start () then change it from there because if I do move it to Start() and do whatever need tobe done then the alert will beep continuesly instead of just one time.

Someone mention to use variable Static or something, please anyone can further assist me, thx.