How to code? - page 288

 

...

Here is an EA that works as you specified

It will work with ecn type brokers (use EcnBroker parameter for that) and can work with or without stop loss and / or take profit. If you do not specify stop loss or take profit it will close the order if an opposite order should be opened. It uses the "ema + rsi binary" indicator posted some posts ago for signals. In this for I think you will find it easy to modify and customize it to your needs

regards

dipu:
Thanks for reply, MLADEN,

sorry not for clear information.......

BUY: EMA 5 Cross EMA 12 to upside, RSI[14] greater than 50

SELL: EMA 5 Cross EMA 12 to downside, RSI[14] less than 50

Exit: with small TP/Sl....(5pip)

(only one trade in every EMA crossover)

I just try out it & will inform u the reasult....

May it also modify.. or not..

Thanks again for your help.....
Files:
dipu_2.mq4  5 kb
 

Thanks ... MLADEN,

I tried the EA. But the result is so bad that I can't describe to you..

But when I scalping with this Strategy manually, It's look so good. I gain almost 9 trade out of 10.

I don't know what's the problem with this EA. May its need more filter to ignore false signal.

I describe my detail strategy if you can help...

BUY: EMA 5 Cross EMA 12 to upside, RSI[14] greater than 50

SELL: EMA 5 Cross EMA 12 to downside, RSI[14] less than 50

Exit only 2-3pips to sure gain with a big lot.

Not to SELL at SUPPORT, not BUY at RESISTANCE.

here is image to indicate Signal and false signal.......

Thanks again for your help.....

Files:
chart.jpg  181 kb
 

...

dipu

First of all, try using this indicator attached here instead of the previous version. MaMode parameter added and it is set to default EMA (it seems that I made it use SMA mode in the previous version ... this one is corrected and allows you to set moving average mode you wish)

______________________________

Now it will take exactly those signals you described. You can check all the code for yourself (all the source is posted) so it is doing exactly as you described it. You can set the BarToTestparameter to 0 (since it seems that you are doing an open bar scalping) but you can get a lot of false signals in that case. Anyway, you have the code now which you can modify as you wish (to avoid the signals you have marked with red crosses for example, since, as far as the conditions you have described, those are still valied signals)

The "Not to SELL at SUPPORT, not BUY at RESISTANCE." is a novelty in your list of conditions and you will have to quantify it somehow in the EA though (rules that are "codeable", but I suppose that those rules that are so obvious to human being are going to be the hardest to you to quantify). Also, a take profit of 2-3 pips is going to be almost impossible to place at order on a lot of brokers (there is a minimal distance which you must obey)

all the best

dipu:
Thanks ... MLADEN,

I tried the EA. But the result is so bad that I can't describe to you..

But when I scalping with this Strategy manually, It's look so good. I gain almost 9 trade out of 10.

I don't know what's the problem with this EA. May its need more filter to ignore false signal.

I describe my detail strategy if you can help...

BUY: EMA 5 Cross EMA 12 to upside, RSI[14] greater than 50

SELL: EMA 5 Cross EMA 12 to downside, RSI[14] less than 50

Exit only 2-3pips to sure gain with a big lot.

Not to SELL at SUPPORT, not BUY at RESISTANCE.

here is image to indicate Signal and false signal.......

Thanks again for your help.....
Files:
 

Thanks ... MLADEN,

I m so sorry, it can't work according my strategy. I m so confused. Can u remake it as a good EA with added some filter.. or give me some idea about good EA that has a best performance.

Thanks again for your help... &

Wish u all the best.

 

Filling in histgram with color

My broker only has MT4 currently. I currently use the Ichimoku as one of my technical indicators. In MT4 the histogram for the cloud are vertical lines in different colors. I have seen the Ichimoku on MT5 and instead of vertical lines the cloud is a solid color. How do I modify the Ichimoku for MT4 for a solid color instead of vertical lines?

Jim

 

Hi Jim,

should be enough to select the largest width for the up/down kumo, using the Ichimoku that you'll find on the "indicator" folder, not that one in the "custom indicator" folder...

Regards

gorillamotors:
My broker only has MT4 currently. I currently use the Ichimoku as one of my technical indicators. In MT4 the histogram for the cloud are vertical lines in different colors. I have seen the Ichimoku on MT5 and instead of vertical lines the cloud is a solid color. How do I modify the Ichimoku for MT4 for a solid color instead of vertical lines? Jim
 

I actually tried that yesterday but it didn't work. Guess what it is working today. Thanks.

 

How to Create new formula ?

Hi everyone

I'm new in Meta trade Scripts. I want to create a script with mutiple currency

i want to create a scripts with a formula let say A=GBPUSD(sale)+0.01USDJPY(sale) and B=GBPUSD(buy)+0.01USDJPY(buy) and load in template which plot graph A and B with different line color in EURUSD chart .

 

...

I am afraid that it is not clear what are you trying t achieve

What would GBPUSD(buy), USDJPY(buy) ,GBPUSD(sell) and USDJPY(sell) exactly be?

If they are bid ans ask, then a solution would look something like this :

double currentBids = MarketInfo("GBPUSD",MODE_BID)+0.01*MarketInfo("USDJPY",MODE_BID);

double currentAsks = MarketInfo("GBPUSD",MODE_ASK)+0.01*MarketInfo("USDJPY",MODE_ASK);

but you can not get historical bid and ask values (values in the past), so the only thing you can get is a current value of those for some symbol

ghaza:
Hi everyone

I'm new in Meta trade Scripts. I want to create a script with mutiple currency

i want to create a scripts with a formula let say A=GBPUSD(sale)+0.01USDJPY(sale) and B=GBPUSD(buy)+0.01USDJPY(buy) and load in template which plot graph A and B with different line color in EURUSD chart .
 

Stop Loss, Take Profit with ECN Broker

Friends,

I'm a newbie to MQL4 programming and need help attaching a SL & TP to an ORDERSEND with an ECN broker.

Initially, I couldn't understand why the SL & TPs were making my order result in an error until someone pointed out that one has to set the StopLoss & TakeProfit field within the ORDERSEND to "0" or else an ECN/STP broker will not execute the order.

So, my question is: How can I execute an order at Market and then immediately (or within a second or two) attach a SL/TP to that ticket?

Here's a piece of the code pertinent to my questino:

if((CurrentPriceBuy>UpperPriceTrigger) && TakeAction==1)

{

OrderSend(Sym,OP_BUY,Lots,CurrentPriceBuy,0,0,0,Comm,0,0,CLR_NONE);

TakeAction=0;

}

Can anyone help me insert code right after the OrderSend command so that I can attach a TP/SL of say arbitrarily 25pips to that specific ticket?

Any help would be greatly appreciated. Thanks in advance.

Regards,

Kasio

Reason: