[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 109

 
alsu:



It's better that way.

int BarsAfterCCICrossZero(int cci_period, int applied_price)
{
   int i;

   for(i=1;i<Bars-cci_period-1;i++)
   {

      double cci1 = iCCI(Symbol(),Period(),cci_period,applied_price,i);
      double cci2 = iCCI(Symbol(),Period(),cci_period,applied_price,i+1);

      if(cci1*cci2<0) return(i);

   }

   return(-1);// т.е. пересечений не было
 
sergeev:

all at once? No.

only one at a time.

Is it even technically feasible to do it?
 
Can you please tell me how to open one order for one signal? The conditions for opening and closing are different. if(OrdersTotal()==0) works if the conditions match. For example, opening by Stoch(8,5,5) and closing by Stoch(5,3,3), it turns out that Stoch(5,3,3) closes the order but Stoch(8,5,5) (it reacts to the change of chart movement later) remain conditions for order opening. During the divergence of indicators Stoch(8,5,5) opens an order sinceif(OrdersTotal()==0), on the next tickStoch(5,3,3) closes the order. This happens on every tick until Stoch(8,5,5) also shows the change of chart movement.How should I make the next order be opened only when Stoch(8,5,5) shows the change of price movement? Thank you in advance.
 
KoOr:
Please, advise how to open one order at one signal? The conditions for opening and closing are different. if(OrdersTotal()==0), it works if the conditions match. For example, opening by Stoch(8,5,5) and closing by Stoch(5,3,3), it turns out that Stoch(5,3,3) closes the order but Stoch(8,5,5) (it reacts to the change of chart movement later) remain conditions for order opening. During the divergence of indicators Stoch(8,5,5) opens an order sinceif(OrdersTotal()==0), on the next tickStoch(5,3,3) closes the order. This happens on every tick until Stoch(8,5,5) also shows the change of chart movement.How should I make the next order be opened only when the Stoch(8,5,5) shows the change of the price movement? Thank you in advance.

I have already answered you on the previous page! Only place the functions outside of int start() and call them in terms of placing an order or opening a position:

if(ExistOrders() == False && ExistPositions() == False)
{
        //и дальше условия постановки ордера или открытия позиции с вашими стохастиками и т.п.
 
Thanks, I'll give it a try.
 
Server:
Is it even technically feasible?
It's a piece of cake.
 
artmedia70:
It's as easy as that


Thank you for your response
 
Server:

Thank you for your answer.

But only one at a time
 
Vinin:

But only on a first-come, first-served basis.

What do you mean by queue, I'm new to the forum what's the queue?
 
Server:

I mean the queue, I'm new to the forum.

What's this got to do with the forum?

what's the queue?

The order queue of course.