Open more than 1 order?

 

Hi there

Im not very good at coding

Im having problem with an EA


The problem is. It only opens one order at the time.


I have tryed set the OrdersTotal();

But if i set the orderstotal to 100 for example it opens like 5 orders at the same price. Thats not what iwant!


This is how i want it to work

For example:

If my EA take one position when stochastic reaches 20

I want it to take one more position when stochastic reaches 50


Can someone please help me with this coding problem.

I created the EA at http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/


Thanks/
Files:
 
pontuso:

I have tryed set the OrdersTotal();

You don't set it . . . please read the documentation . . . OrdersTotal
 
RaptorUK:
You don't set it . . . please read the documentation . . . OrdersTotal

Okay thnks =)

But how should i do to make it work?

Sorry for my stupid questions im not so good at this.

 
I don't know anything about Stochastics . . . should I learn so I can fix your code for you ? or should you learn so you can fix your own code ?
 
RaptorUK:
I don't know anything about Stochastics . . . should I learn so I can fix your code for you ? or should you learn so you can fix your own code ?

Ok thanks anyway

 
find if there is an open position open (u can use MagicNumbers for that (for example)) & open another position when the time is right (stochastic reaches 50 )
 

Hi Pontuso,

you may use ordercomment to identify whether is there already an open position for the current signal.

eg.

double marker = iLow(NULL,0,1); //identifying the current bar

string markerstr = DoubleToStr(marker,4); // to string

double pos_in_this_bar = 0;

for(int k=OrdersTotal();k>=0 ;k--)

{

OrderSelect(k,SELECT_BY_POS);

if (OrderComment() == markerstr) pos_in_this_bar= pos_in_this_bar+1;

}


if (....................... && pos_in_this_bar ==0) // just oopen the trade if there is not a position for the current signal

OrderSend(Symbol(),OP_SELL,Lots,Ask,30,0,0,markerstr,MAGICMA,0,Red); // use the identifier as comment

 
Szilar:

Hi Pontuso,

you may use ordercomment to identify whether is there already an open position for the current signal.

OrderComment is a bad idea . . . it can be amended or totally overwritten by your Broker. It's not a reliable method.
Reason: