Ask! - page 66

 

Invisible Stoploss

I have and EA that places two hedged orders on one currency pair. I believe it is possible to set it up so that it uses an invisible StopLoss, so to speak. Basically, what I'm thinking is to define, for example, a variable like Buy_StopLoss and Sell_Stoploss, and then define in some Close Order logic the following:

if (Bid == OrderOpenPrice() + Buy_StopLoss) Order = SIGNAL_CLOSEBUY;

if (Order == SIGNAL_CLOSEBUY) {

OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, Yellow);

if (!EachTickMode) BarCount = Bars;

IsTrade = False;

continue;

}

}

} else {

if (Ask == OrderOpenPrice() + Sell_StopLoss) Order = SIGNAL_CLOSESELL;

if (Order == SIGNAL_CLOSESELL) {

OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, Yellow);

if (!EachTickMode) BarCount = Bars;

IsTrade = False;

continue;

My question is

1. Will this work??

2. Does the EA know which OrderOpenPrice() to use to close the correct order??

 

You have to run that in a loop where the order is selected; then OrderOpenPrice() and OrderTicket() are defined.

If your Buy_StopLoss is in pips, do not forget to multiply it by Point.

 

hi all, i'm trying to create a new indicator to display alerts for some variables of _madrogoldenfilter indicator

i'm using:

madroup=iCustom(NULL,0,"_MadroGoldenFilter",5,15,1,1,8,17,9,21,14,14,14,14,5,lookupidx);

madrodown=iCustom(NULL,0,"_MadroGoldenFilter",5,15,1,1,8,17,9,21,14,14,14,14,4,lookupidx);

if (madroup>0.1)

maval=1;

else

maval= 0;

but it's not working. I think it's because the variables in madrogoldenfilter don't always have values.

Any hints on how to call those values from madro variables?

Files:
 
camisa:
hi all, i'm trying to create a new indicator to display alerts for some variables of _madrogoldenfilter indicator

i'm using:

madroup=iCustom(NULL,0,"_MadroGoldenFilter",5,15,1,1,8,17,9,21,14,14,14,14,5,lookupidx);

madrodown=iCustom(NULL,0,"_MadroGoldenFilter",5,15,1,1,8,17,9,21,14,14,14,14,4,lookupidx);

if (madroup>0.1)

maval=1;

else

maval= 0;

but it's not working. I think it's because the variables in madrogoldenfilter don't always have values.

Any hints on how to call those values from madro variables?

That is one strange indicator. What signals are you trying to add alerts to?

 
ryanklefas:
That is one strange indicator. What signals are you trying to add alerts to?

I trying to add alerts when the grey/gold little squares appear (value 5 and value 6 from madrogoldenfilter indicator window)

 
camisa:
I trying to add alerts when the grey/gold little squares appear (value 5 and value 6 from madrogoldenfilter indicator window)

Sometimes, when the variables don't have values, they default to the maximum value which is something like: 235465464654... It's some really huge number. That could be causing your problem.

 
ryanklefas:
Sometimes, when the variables don't have values, they default to the maximum value which is something like: 235465464654... It's some really huge number. That could be causing your problem.

hum I tried

if (madroup>0.1 && madroup<1)

because when madroup has a value, it's always 0.22

but to no avail :P

 

Where to download the script for ProfitProtector Expert Advisor

Hi codersguru,

I am very new to the MQL4 programming. I have downloaded your pdf manual. And I have found that you have explained the code snippets very well in the manual. I am very interested in learning about the Expert Advisor and surprised to learn that you can do a lot of things with this language for trading. In the manual, you have mentioned that I can download the ProfitProtector script from your site. So far, I am not able to find the script. Please guide me how to download the sample script.

Thanks

 

Guideline or Template to Make an MTF Version of an Indicator

Hi.

I have requested in other threads for help to make an MTF version for the RMI Indicator which I substitute for RSI.

Since no one seems interested, I might just as well take a crack at doing it.

Could someone be kind enough to point me in the right direction where I can find the code to add to make the MTF version or maybe at least learn to make MTF versions of Indicators. I know not all indicators can have MTF versions.

Thank you in advance to whoever can help.

yano125

 

Heiken Ashi within an ea help please

I have the following code in a ea, but I am looking for a way so that it will only enter a new trade if Heiken Ashi has changed from one color to the other colour and back again. eg. it enters a trade when blue and exits once profit is hit. Now it can not enter again untill it turns red and the back to blue.

bool CheckHeikenAshi(int cmd)

{

haOpen = iCustom(NULL,0,"Heiken_Ashi_Smoothed",MaMetod,MaPeriod,2,1);

haClose = iCustom(NULL,0,"Heiken_Ashi_Smoothed",MaMetod,MaPeriod,3,1);

switch (cmd)

{

case OP_BUY : if (haOpen < haClose) return(true);

break;

case OP_SELL : if (haOpen > haClose) return(true);

}

return(false);

}

Thanks in advance.

basza