MQL4 Learning - page 70

 

How get the current value of price?

Hi all,

In my EA I need to get the current value of price.

Can you help me?

 
danielitos85:
Hi all,

In my EA I need to get the current value of price.

Can you help me?

Err... that would be Ask and Bid

Welcome to the world of Forex and forex-tsd.com

Lux

 

Why alert message not appear if written in the special function start()?

Dear experts,

I am new to meta trader and currently learning about it. Hope the

experts here can point me out the reasons.

1. Why the Alert message that I wrote in special

function Start() is not coming out while the rest 2 Alert message

written in Init () and Deinit () coming out?

2. Under what condition, then only we write the custom function (own

defined) in the Init ()? I thought they should be written out of the

Init () and Start()?

That's all for now. Thank you.

 

MA cross over

Can someone help with a mq4 code. I want to manually place an order Buy/Sell and when the Ma 4 crosses the MA 8 indicator it will close the trade and reset. Waiting for the next placed order. Any currency pair or multiple currencies.

Thanks in advance

 

in my Ea i have multiple order like 2 or 3 depend of time, and i want to have different trailing, like one trailing is about 40 pip about the first order, the second trailing is about 50 about second order and so on, how i can do it??

Can someone help with a mq4 code. I want to manually place an order Buy/Sell and when the Ma 4 crosses the MA 8 indicator it will close the trade and reset. Waiting for the next placed order. Any currency pair or multiple currencies. Thanks in advance

give a look here they use 2 simple moving avrege to open an order like your

Usage of Technical Indicators - Simple Programs in MQL4 - MQL4 Tutorial

 

Trade Context Busy

Is there any code fragment that will allow me to keep sending an open or close when I get the trade context busy error. Thanks in advance for any help

 

Intersection Alert

I'm a bit new to this but I'm trying to find an alert. I would like to have an alert generated (with an arrow) when two moving averages are 'x' distance from each other but I only want it to check for the distance at the end of the period (M1, M5 etc).

Any ideas of existing code for this?

Thanks

 
bartman:
I'm a bit new to this but I'm trying to find an alert. I would like to have an alert generated (with an arrow) when two moving averages are 'x' distance from each other but I only want it to check for the distance at the end of the period (M1, M5 etc).

Any ideas of existing code for this?

Thanks

Sound Alerts in Indicators - MQL4 Articles

 

Today Profit Balance - check every bar

Hello, I need a little help here..

How can I edit this code so it will check my today profit on every bar. At the moment this code only trigger is there is an order closed. Appreciate any help..

Thanks

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

//| Close Condition Type 9C |

//| CHECK ACCOUNT BALANCE then close biggest price different |

//| |

//| select the biggest price different order > current price |

//| if TODAY PROFIT/LOSS (at ACCOUNT HISTORY/AccountProfit) |

//| is bigger > Profit2ExitTodayBalance |

//| then |

//| CLOSE ORDER LOT = PartialCloseLot |

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

void CheckCloseConditionType9c()

{

int ticket1;

double max_dist;

for (;;)

{

ticket1 = -1;

int cnt = OrdersTotal();

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

{

if (!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue;

if (OrderSymbol() != Symbol()) continue;

if (OrderMagicNumber() != Magic) continue;

int type = OrderType();

if ((type == OP_BUY || type == OP_SELL) == false) continue;

RefreshRates();

if (ticket1 == -1 || MathAbs(Bid - OrderOpenPrice()) > max_dist)

{

ticket1 = OrderTicket();

max_dist = MathAbs(Bid - OrderOpenPrice());

}

}

if (ticket1 == -1) break;

if (BuyCnt+SellCnt <= 1) break; //DO NOT PROCEED IF TOTAL OPEN ORDER IS LESS THAN

//-----

double today_hist_profit = GetTodayProfit(MODE_HISTORY);

if (today_hist_profit <= Profit2ExitTodayBalance) break;

if (OrderSelect(ticket1, SELECT_BY_TICKET))

{

double lot = PartialCloseLot;

if (lot > OrderLots()) lot = OrderLots();

for (i=0; i < RepeatN; i++)

{

RefreshRates();

bool res = OrderClose(OrderTicket(), lot, OrderClosePrice(), Slippage, clClose);

Comment("Order close by Condition type 9c");

Print("Order close by Condition type 9c");

if (res) break;

}

}

}

}

 

Changing the font size

The default font size of MT4 is good for online monitoring, but when printing to capturing an image of the chart the numbers on the axis are too small to be read.

Is there a way to show few but large number on axises ?

Reason: