hi...newbie need help with simple code

 

Hi all,

I try to write an EA code for buy array but I can’t get it works if you can help me out with the code I’ll greatly thank you...

This is what I try to do,

if previous buy price is 1.75, then current buy price must be 1.76

sound simple but hard for beginner ..please help!
 
vv3377:

Hi all,

I try to write an EA code for buy array but I can’t get it works if you can help me out with the code I’ll greatly thank you...

This is what I try to do,

if previous buy price is 1.75, then current buy price must be 1.76

sound simple but hard for beginner ..please help!

Do U have any coding experiance?

 
Blooper1980 wrote >>

Do U have any coding experiance?

just a little...

 

Try assining every price to and array with an incremental int variable. If U want to "save" every bar price.

Else just say if eg. int count==3 then count=0 since it seems U only want to save 2 price's at an time.

Hope this helps.

 
Blooper1980 wrote >>

Try assining every price to and array with an incremental int variable. If U want to "save" every bar price.

Else just say if eg. int count==3 then count=0 since it seems U only want to save 2 price's at an time.

Hope this helps

Thank you for your inputs...

I want some one to help me write the code because i can't write the code correctly, that is what i am asking for

 

Don't save it, go find it.

int start()
{
   datetime lastBuyTime;
   double lastBuyPrice;

   LastBuy(lastBuyTime, lastBuyPrice);

   Print("Last Buy Time = ", TimeToStr(lastBuyTime, TIME_DATE|TIME_SECONDS));
   Print("Last Buy Price = ", lastBuyPrice);

   return(0);
}
//+------------------------------------------------------------------+

//function

void LastBuy( datetime &lbt, double &lbp){
   for(int i = OrdersTotal()-1; i >= 0; i--){
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if(OrderSymbol() == Symbol()){
         if(OrderType() == OP_BUY){
            if(OrderOpenTime() > lbt){
               lbt = OrderOpenTime();
               lbp = OrderOpenPrice();
            }
         }
      }
   }
   for(   i = OrdersHistoryTotal()-1; i >= 0; i--){
      OrderSelect(i, SELECT_BY_POS, MODE_HISTORY);
         if(OrderSymbol() == Symbol()){
            if(OrderType() == OP_BUY){
               if(OrderOpenTime() > lbt){
                  lbt = OrderOpenTime();
                  lbp = OrderOpenPrice();
               }
            }
         }
      }
   }
}
 
phy wrote >>

Don't save it, go find it.

Ray, thank you very much for your codes and thanks for your kindness...

here is my code it was working couple trades on the tester but after that its did not open trade any more so i think maybe something is missing or maybe " (CurrentOrderPrice < PreviousOrderPrice)" is not correctly coding. I very appreciate if you can point out the problem

Thanks.

if(Fibo < 1)
{
if(CurrentOrderPrice < PreviousOrderPrice);

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*MarketInfo(Symbol(),MODE_POINT),
Ask+TakeProfit*Point,
"My EA",12345,0,Green);

 
You don't show enough code to draw any conclusions.
Reason: