//
Hi all.
I have traded manually for more than 2 months and now I want to write an alerting system (not really an EA that make real order) to alert me about important events.
I do not have strong programming background and also not so familiar with mql4 language.
Could you please help me translate my pseudo code to the mql4 code? Or if you don’t have much time, give me some examples how to write mql function of some lines in my pseudo code.
This is my ‘hello world’ mql program. I really appreciate any advice how to improve it
The program is intended to be used in current opening chart (1 pair, 1 time frame). The idea is to alert when some event happen in a specific scenario (market state). The only indicator used is Bollinger band(20,2).
int market_state = 0
int alert1 = 0
int time_interval = 15 //minutes
double percent = 0.03
double small_value = 0.01
//determine market state
while (current_bar close)
do
{
if (current_time - time_interval) / current_time > percent
{ if (current_time - 2 * time_interval) / current_time > 2* percent
market_state = 1 //trend market
}
if (current_time - time_interval) / current_time < small_value
{ if (current_time - 2 * time_interval) / current_time < small_value
market_state = 2 //flat market
}
}
//alert correspond to market state
while (market_state = 1 )
do
{
if (openprice - MA(20))*(MA(20) - closeprice) >0 //price pass MA(20) string
alert1(messege1, sound1)
alert1 = 1
if (currentprice = MA + 1.5 StandardDeviation and alert1 = 1) OR (currentprice = MA - 1.5 StandardDeviation and alert1 = 1)
alert2(messege2, sound2)
alert1 = 0 //reset alert1
market _state =0 //reset market_state
}
while (market_state = 2 )
do
{
if (closing_price < bands(20) lower ) OR (closing_price > band(20) upper )
alert3(messege3, sound3)
market _state =0 //reset market_state
}