Ask! - page 136

 

suspend order

Hello folks,

with respect to programming in MQL4 I'm a real newbie, but I'm learning every day. Currently I'm trying the following:

in the main loop of my EA, when certain conditions are met, an order is opened. This order is with a given entry, stoploss and takeprofit using the OrderSend function.

Only one order at the time is allowed:

total = OrdersTotal();

if(total < 1)

{ etc etc

What I'd like to build is that when the order's stoploss or takeprofit is hit, the EA waits with taking new orders until the current hourly bar (the bar within the stoploss or takeprofit is hit) finishes.

The problem at the moment is that as soon as the stoploss or takeprofit is hit, immediately another order is taken in the main loop.

Can you guys please help me out ?

FXX

 

Combine EA need help

Hi all,

Any one know how to combine 2 difference EA in 1 EA ? Please show me step by step how to do this ?

Thanks in advance for your help !

 

Depends on The EA's Logic

Each EA has different logic, so the method to combine two ea's depends on their logic..

So Where's the ea's you would like to combine?

Bill FX:
Hi all,

Any one know how to combine 2 difference EA in 1 EA ? Please show me step by step how to do this ?

Thanks in advance for your help !
 

How To Rank Values ? Need Helps

Anybody can help me how to create rank function

for example I have some double value like theese:

a=3.0; b=4.0; c=5.0; d=2.0; e=1.0; f=6.0; g=0.0;

from higher to lower value (6.0, 5.0, 4.0, 3.0, 2.0, 1.0, 0.0)

or the value of (f,c,b,a,d,e,g)

So the rank's should be like this

rank number: (th)

f=1 ; c=2; b=3; a=4; d=5; e=6; g=7;

What I need is a function than return the rank if I input the value

int rank (double value)

{

process all value's;

return (the rank of a value from all value's)

}

I know it is easy if we just make a function like this

for example value of "a"

int rank (double value)

{

if(a>b && a>c && a>d && a>e && a>f && a>g)

return (1);

.

.

.

if(a<b && a<c && a<d && a<e && a<f && a<g)

return(7);

}

The Problem is when the variations of value are 2 the combination only a few, but when the variations increase for example 5,7 or 10 etc so the combination to make the rank will very very a lot..

Hope somebody can help me for this kind of problem..

Thank's berfore, Sorry for my poor english, but I'm learning..

Pj..

 

Use an array and take a look at the ArraySort() function.

Good luck

Lux

 

Stoch OBOS

I like this indi stoch very much, but i need help to change it, because i need the alert when the stoch touch over bought over sold area. And when it alert, it can show what currency too.

Thank you in advance.

 
luxinterior:
Use an array and take a look at the ArraySort() function.

Good luck

Lux

I'd tried that but still confused,

need somebody who could teach or show me how to do that thing..

Perhaps You Could Lux?

Thank's in advance

 
primajaya:
Each EA has different logic, so the method to combine two ea's depends on their logic.. So Where's the ea's you would like to combine?

Hi primajaya,

Thanks for your feedback. I mean the 1st EA is open trades and the 2nd EA is close trades, if the 1st EA open trades and has some profits and I want the 2nd EA close trade at XXX profits, so how should I do ? They are work if I attach in to 2 chats but I want to combine 2 in 1 than I just need open 1 EA only.

Thanks for your help!

 
Bill FX:
Hi primajaya,

Thanks for your feedback. I mean the 1st EA is open trades and the 2nd EA is close trades, if the 1st EA open trades and has some profits and I want the 2nd EA close trade at XXX profits, so how should I do ? They are work if I attach in to 2 chats but I want to combine 2 in 1 than I just need open 1 EA only.

Thanks for your help!

I still don't know about the logic 1st and 2nd EA to open trades...

But perhaps this can help you..

Try to combine the two ea's into one single EA..

So the EA should be has two signal to open trades:

1st signal from 1st EA and 2nd signal from the 2nd EA..

you may use OrderMagicNumber() as the identity for each open trades made by two signals...

for example:

if open trades by 1st signal then -- magic number is 1111

if open trades by 2nd signal then -- magic number is 2222

So if we want to close trade from the second signal we can use OrderMagicNumber() as identity to close:

Hope it helps...

Pj

 

10points3

PLEAASEEE, PROGRAMMERS!

We need in 10points3 EA, that when the third trade opens, the first one closes, I'm trying but it's still closing all positions.

actually we have:

if (PreviousOpenOrders>OpenOrders)

{

for(cnt=OrdersTotal();cnt>=0;cnt--)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

mode=OrderType();

if (OrderSymbol()==Symbol() && OrderMagicNumber() == Magic)

{

if (mode==OP_BUY) { OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),slippage,Blue); }

if (mode==OP_SELL) { OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),slippage,Red); }

return(0);

}

}

}

I was thinking to do this:

1. change magic number for the first trade when second one opens, for example magicnumber+1

2. when third trade opens, close the first one, with the magicnumber+1 assigned.

Am I right?

or which other way I can identify the first trade opened to close it later?

If you can guide me or make the changes, better because I'm not a programmer, I'm just learning.

This change would be the start of the Holly Grail!!!

Files:
10p3v0.03_1.mq4  12 kb
Reason: