Ask! - page 79

 

Alert MTF HAS

Hi codersguru,

I found this great article "Alert Once Per Bar" and I tried to make it works with 8 MTF HAS , but unfortunately I dont know how to do it, can you please add sound alert and popout window then signal shows up.

Thank you for your help!

Files:
8_tf_has.mq4  11 kb
usdjpy_15.jpg  112 kb
 

Draw 2 indicator in one window

Hi All Programmer

How can i draw 2 indicator in one window, ie rsi and stochastic ?

Regards

aye

 
ayejkt:
Hi All Programmer

How can i draw 2 indicator in one window, ie rsi and stochastic ?

Regards

aye

You can open one and then drag the other into the same window if they are sub windows, then you get 2 in one

If they are main window then you can combine them with code but it is tricky

 

Is there a way to show which template you have loaded on a chart?

 

Alert MTF HAS - last post #787

Here is code from "Alert Once Per Bar"

bool AlertOnce(string alert_msg, int ref)

{

static int LastAlert_1 = 0;

static int LastAlert_2 = 0;

static int LastAlert_3 = 0;

static int LastAlert_4 = 0;

switch(ref)

{

case 1:

if( LastAlert_1 == 0 || LastAlert_1 < Bars )

{

Alert(alert_msg);

LastAlert_1 = Bars;

return (1);

}

break;

case 2:

if( LastAlert_2 == 0 || LastAlert_2 < Bars )

{

Alert(alert_msg);

LastAlert_2 = Bars;

return (1);

}

break;

case 3:

if( LastAlert_3 == 0 || LastAlert_3 < Bars )

{

Alert(alert_msg);

LastAlert_3 = Bars;

return (1);

}

break;

case 4:

if( LastAlert_4 == 0 || LastAlert_4 < Bars )

{

Alert(alert_msg);

LastAlert_4 = Bars;

return (1);

}

break;

}

}[/CODE]

and here is part of code 8 MTF HAS

[CODE]

haOpen = iCustom(NULL,prd,"Heiken_Ashi_Smoothed",MaMetod,MaPeriod,MaMetod2,MaPeriod2,2,yy) ;

haClose = iCustom(NULL,prd,"Heiken_Ashi_Smoothed",MaMetod,MaPeriod,MaMetod2,MaPeriod2,3,yy) ;

double dUp = EMPTY_VALUE;

double dDn = EMPTY_VALUE;

if (haOpen<haClose) dUp = 1; else dDn = 1;

switch (tf)

{

case 0: if (dUp == 1) buf1 = 1;

else buf1 = EMPTY_VALUE; break;

case 1: if (dUp == 1) buf2 = 1 + Gap * 1;

else buf2 = EMPTY_VALUE; break;

case 2: if (dUp == 1) buf3 = 1 + Gap * 2;

else buf3 = EMPTY_VALUE; break;

case 3: if (dUp == 1) buf4 = 1 + Gap * 3;

else buf4 = EMPTY_VALUE; break;

case 4: if (dUp == 1) buf5 = 1 + Gap * 4;

else buf5 = EMPTY_VALUE; break;

case 5: if (dUp == 1) buf6 = 1 + Gap * 5;

else buf6 = EMPTY_VALUE; break;

case 6: if (dUp == 1) buf7 = 1 + Gap * 6;

else buf7 = EMPTY_VALUE; break;

case 7: if (dUp == 1) buf8 = 1 + Gap * 7;

else buf8 = EMPTY_VALUE; break;

}

Is it posible to make it works , I tried and always got error. Can someone take a look at this code, please.

 

2 in 1

Increase,

thanks for your effort to help me, but i stil can't doing it, make the rsi and stoch in 1 subwindow. How to drag it ?

would you enlighten me more ?

regards

aye

Files:
 

Can anyone point me to an EA that can place simultaneous buy and sell orders, similar to hedged orders. on the same currency pair.

 
waaustin:
Can anyone point me to an EA that can place simultaneous buy and sell orders, similar to hedged orders. on the same currency pair.

Try this EA on USDJPY, time frame=M1.

maxdrawdownpercent = 0.05;

Files:
 

Can you help me to add in these expert code of closing all treding position at 22:00

Can you help me to add in these expert code of closing all trading position at 22:00

Thank you

Files:
crosser.mq4  6 kb
 
Bongo:
Try this EA on USDJPY, time frame=M1. maxdrawdownpercent = 0.05;

It's an ex4 file. I can't open it up in Metatrader. I'm actually interested in seeing the code to see how the EA is coded to enter simultaneous buy/sell orders on the same currency pair to see if I can incorporate the same methodology in my EA.

To be more specific, what I am actually wanting my EA to do is the following:

The EA will enter a buy/sell trade based on certain condition. Once The initial trade is entered, it sometimes may take three to five days before it finally closes out at takeprofit. In the meantime, during that three to five day period, there may be several trade opportunities in the opposite direction. I want the EA to take advantage of those opportunities while leaving the original trade open because it will eventually close out in profit. These additional trade opportunities in the opposite direction of the original trade will technically be a hedge against the original trade, even though they will eventually also close out at takeprofit. To be clear though, I still only want the EA to only have one trade open in the same direction. So, the max trades open at the same time would be one buy and one sell.

I've attached copy of my EA order placement logic

I hope this helps!