manone
101
manone  

hi mladen or anyone,

i notice that mt4 platform has some default indicators (though some are repeat in custom indicators part,), but the code i think is not exact the same, how to retrieve or see the code of those default indicators, thanks a lot for inform me.

Mladen Rakic
200742
Mladen Rakic  
kenwa:
hi mladen or anyone, i notice that mt4 platform has some default indicators (though some are repeat in custom indicators part,), but the code i think is not exact the same, how to retrieve or see the code of those default indicators, thanks a lot for inform me.

You can not

Those are built in indicator (executed directly by the terminal)

manone
101
manone  

seems those built in indicators are better than those in custom indicator session in function, really no way to know the code of them?

Mladen Rakic
200742
Mladen Rakic  

Someone asked me how I am using the multi time framing from a single file (when it is not possible to call built in functions)

Here is one simple example and some explanations in it

_____________________________

The indicator attached behaves like 3 indicators in one and in the code you will find comments what is done and when. I hope this helps some people to clear how a single file correct multi time frame indicator can be made (that will, among other things, always calculate correct number of bars, without assuming how many bars in the target time frame have been changed).

So this simple single file multi time frame indicator can easily be used as a template for multi time frame indicators

Files:
manone
101
manone  

hi mladen,

do you know is it possible and how to do iStochasticOnArray? any template or formulae to do that? thanks for inform.

Mladen Rakic
200742
Mladen Rakic  
kenwa:
hi mladen, do you know is it possible and how to do iStochasticOnArray? any template or formulae to do that? thanks for inform.

kenwa

There is no such thing as a built in function. At these posts you can see how a function to do that can be written and how can it be used then : https://www.mql5.com/en/forum/177239/page34

manone
101
manone  

hello mladen:

a bit profound for me

e.g.double iStoch(double priceR, double priceH, double priceL, int period, int slowing, int i, int instanceNo=0) is it doubles within double? is this method can reduce indexbuffer occupied within the mq4?

this bit strange to me of its function:

stoch = iStoch(rsi,rsi,rsi,StoPeriod,StoSlowing,i);

thanks for some clarify.

metrus
49
metrus  
mladen:
I don't know why it does not accept the other wav file

If you have changed it in the code it should accept it

To repeat it 5 times you should place it in a loop, but that might cause some problems (if the sound file is too long)

Here is the code that I used (I know very little about coding to know how to do loops):

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

#property copyright "https://www.forex-tsd.com"

#property link "https://www.forex-tsd.com"

#property indicator_chart_window

//-----------------------------------------------------------------

extern int alertsForNotOlderThan = 300;

extern int alertsForMagicNumber = 0;

extern string alertsForSymbol = "";

extern bool alertsOn = true;

extern bool alertsSound = true;

extern bool alertsMessage = true;

extern bool alertsNotification = false;

extern bool alertsEmail = false;

//-------------------------------------------------------

//

//-------------------------------------------------------

//

//

//

//

//

int tickets[];

bool alerted[];

string symbols[];

int types[];

int times[];

int init() { return(0); }

int deinit() { return(0); }

int start()

{

//

//

// colect data for orders

//

//

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

{

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

if (alertsForSymbol != "" && alertsForSymbol!=OrderSymbol()) continue;

if (alertsForMagicNumber != 0 && alertsForMagicNumber!=OrderMagicNumber()) continue;

if (alertsForNotOlderThan < (TimeCurrent()-OrderOpenTime())) continue;

//

//

//

//

//

for (int k=ArraySize(tickets); k>0; k--)

if (OrderTicket()==tickets[k-1]) break;

if (k==0)

{

int size = ArraySize(tickets)+1;

ArrayResize(tickets,size); tickets = OrderTicket();

ArrayResize(alerted,size); alerted = false;

ArrayResize(symbols,size); symbols = OrderSymbol();

ArrayResize(types ,size); types = OrderType();

ArrayResize(times ,size); times = OrderOpenTime();

}

}

//

//

// check if some order needs to be alerted for

//

//

for (i=ArraySize(tickets)-1; i>=0; i--)

{

string type = "";

if (!alerted)

{

alerted = true;

switch (types)

{

case OP_BUY : type = "buy"; break;

case OP_SELL : type = "sell"; break;

case OP_BUYSTOP : type = "buy stop"; break;

case OP_BUYLIMIT : type = "buy limit"; break;

case OP_SELLSTOP : type = "sell stop"; break;

case OP_SELLLIMIT : type = "sell limit"; break;

}

doAlert(type+" opened at : "+TimeToStr(times,TIME_DATE|TIME_SECONDS)+" for "+symbols);

}

}

return(0);

}

//-------------------------------------------------------

//

//-------------------------------------------------------

//

//

//

//

//

void doAlert(string doWhat)

{

string message;

message = doWhat;

if (alertsMessage) Alert(message);

if (alertsEmail) SendMail(StringConcatenate(Symbol()," order alerts "),message);

if (alertsNotification) SendNotification("order alerts "+message);

if (alertsSound) PlaySound("hallelujah.wav");

}

but it just rings the regular alert when triggered.

Thought: if I can't get the PlaySound to change, could you possibly code in a loop that would replay a short regular alert every 1 second for 10 times? - at least that would do a lot more to wake me than just a single regular alert sound . . . .

Thank you

William Snyder
9549
William Snyder  
person77:
Here is the code that I used (I know very little about coding to know how to do loops):

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

#property copyright "https://www.forex-tsd.com"

#property link "https://www.forex-tsd.com"

#property indicator_chart_window

//-----------------------------------------------------------------

extern int alertsForNotOlderThan = 300;

extern int alertsForMagicNumber = 0;

extern string alertsForSymbol = "";

extern bool alertsOn = true;

extern bool alertsSound = true;

extern bool alertsMessage = true;

extern bool alertsNotification = false;

extern bool alertsEmail = false;

//-------------------------------------------------------

//

//-------------------------------------------------------

//

//

//

//

//

int tickets[];

bool alerted[];

string symbols[];

int types[];

int times[];

int init() { return(0); }

int deinit() { return(0); }

int start()

{

//

//

// colect data for orders

//

//

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

{

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

if (alertsForSymbol != "" && alertsForSymbol!=OrderSymbol()) continue;

if (alertsForMagicNumber != 0 && alertsForMagicNumber!=OrderMagicNumber()) continue;

if (alertsForNotOlderThan < (TimeCurrent()-OrderOpenTime())) continue;

//

//

//

//

//

for (int k=ArraySize(tickets); k>0; k--)

if (OrderTicket()==tickets[k-1]) break;

if (k==0)

{

int size = ArraySize(tickets)+1;

ArrayResize(tickets,size); tickets = OrderTicket();

ArrayResize(alerted,size); alerted = false;

ArrayResize(symbols,size); symbols = OrderSymbol();

ArrayResize(types ,size); types = OrderType();

ArrayResize(times ,size); times = OrderOpenTime();

}

}

//

//

// check if some order needs to be alerted for

//

//

for (i=ArraySize(tickets)-1; i>=0; i--)

{

string type = "";

if (!alerted)

{

alerted = true;

switch (types)

{

case OP_BUY : type = "buy"; break;

case OP_SELL : type = "sell"; break;

case OP_BUYSTOP : type = "buy stop"; break;

case OP_BUYLIMIT : type = "buy limit"; break;

case OP_SELLSTOP : type = "sell stop"; break;

case OP_SELLLIMIT : type = "sell limit"; break;

}

doAlert(type+" opened at : "+TimeToStr(times,TIME_DATE|TIME_SECONDS)+" for "+symbols);

}

}

return(0);

}

//-------------------------------------------------------

//

//-------------------------------------------------------

//

//

//

//

//

void doAlert(string doWhat)

{

string message;

message = doWhat;

if (alertsMessage) Alert(message);

if (alertsEmail) SendMail(StringConcatenate(Symbol()," order alerts "),message);

if (alertsNotification) SendNotification("order alerts "+message);

if (alertsSound) PlaySound("hallelujah.wav");

}

but it just rings the regular alert when triggered.

Thought: if I can't get the PlaySound to change, could you possibly code in a loop that would replay a short regular alert every 1 second for 10 times? - at least that would do a lot more to wake me than just a single regular alert sound . . . .

Thank you

Person77,

What used to work for that is go to an open chart, then go to tools/options/events then on alert simply change the wav. to the one you want, but haven't done this in awhile, so not sure if this still works, and make sure the wav file your using is in the sounds folder.

Files:
alert.png 99 kb
metrus
49
metrus  

mrtools - thank you: that worked great!