Saving some prices

 

Hi guys,

I have a for function that returns me some prices. For example 1.4200, 1.4350 and 1.4400. I want to put Buylimit orders to the prices, but i have 2 troubles.

I don't know how to save the prices and keep them with me because my for function only give me 1 price and not 3, I only have 1 variable that takes 3 values now!

On the other hand i want to change the Buylimit every minute, but when I change it i don't know how to delete the old one! I'll give you an example:

time 0:

Price 1: 1.4200 BuyLimit 1

Price 2: 1.4350 BuyLimit 2

I place 2 Buylimits, no problem.

time 1:

Price 1: 1.4200 (I don't have any problem, same price). BuyLimit 1 again

Price 2: 1.4360 Now, i want to delete the BuyLimit 2 and place the BuyLimit 3 at 1.4360


Any idea? Thanks in advance masters ;)

 
 

I tried it before, but i have a problem...

Double My_Array [10]

Ok, now i've the Array, but how can I give diferent prices for the same variable?

My for function variable is Long = Prices, and i get 3 diferent prices, So i can't do

My_Array[1] = Long

My_Array[2] = Long

My_Array[3] = Long

Because it'll change, no?

 

Do this . . .

My_Array[0] = Price1;

My_Array[1] = Price2;

My_Array[2] = Price3;
 
RaptorUK:

Do this . . .


No, no... The for function give me a Long value. Then i can receive 3 prices with the same name "Long", I don't have the Price 1, price 2, etc...

thanks anyway!

 
Maybe you should show your code . .
 
//some rough idea here....

double lLong,ordersLimit=3,buyMaxPrice,sellMinPrice;
  
   if(for_f()!=long){
      lLong=for_f();
      OrderSend(...   
   }
   if(total_limitOrders()>=ordersLimit){//fn to check total buy limit orders, compared to limit set
      int tkt4Deletion=0;
      for(int a=OrdersTotal()-1;a>=0;a--){
         if(!OrderSelect(a,SELECT_BY_POS,MODE_TRADES))continue;
         switch(OrderType()){         
         case 2:if(OrderOpenPrice()>buyMaxPrice){//----iterates & "grep" the highest/lowest prices of limit orders and delete them. 
                  buyMaxPrice=OrderOpenPrice();
                  tkt4Deletion=OrderTicket();
               }
               break;
         case 3:if(OrderOpenPrice()<sellMinPrice){
                  sellMinPrice=OrderOpenPrice();
                  tkt4Deletion=OrderTicket();
               }              
               break;    
         }
         default:continue;
      }
      if(tkt4Deletion>0){OrderSelect(tkt4Deletion,...);OrderDelete(tkt4Deletion);}

hope this helps...