Download MetaTrader 5

how to get Last tick,Current tick and Next tick value in current candle?

To add comments, please log in or register
BinarySchool
43
BinarySchool  

when some condition come true and after that need to find current candle's high to sell order or current candle’s low to buy order in same current candle. How to write code?

please guide me.

void OnStart()
  {
   double tickLast;                          
   double tickCurrent;
   double tickNext;
  
   if(tickLast < tickCurrent > tickNext)
        {
         Sell Order
        }
   
   if(tickLast > tickCurrent < tickNext)
        {
         Buy Order
        }
  
   return(0);
  }

Carl Schreiber
7109
Carl Schreiber  
  1. Use the SRC button if yo0u post code
  2. May be you should start reading the reference and the examples there
  3. Use and study the examples in from ..\Experts and ..\Indicators
  4. Learn to understand the error messages of the compiler
  5. What tick do you mean Bid or Ask?
  6. ...
whroeder1
15592
whroeder1  

BinarySchool:

after that need to find current candle's high to sell order or current candle’s low to buy order in same current candle.

How to write code?

   double tickNext;

  
   if(tickLast < tickCurrent > tickNext)

Please use
SRC
Play video
Please edit your post.
For large amounts of code, attach it.

  1. The "current candle's high" could change because the candle is still forming. And the current candle's high may nor may not be the same as the current tick.
  2. You have only four choices: We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using SRC) and the nature of your problem. No free help. urgent help.
  3. There is no tickNext, the future is not knowable. If you save the current tick (static/global) then, when you get a new tick, you have the last tick.
  4. Last line is meaningless, learn to code. True = 1 and false = 0 so you get
    if( 3 < 2 < 1 )
    if( false < 1 )
    if(     0 < 1 )
    if(     true  )
    if( 3 > 2 > 1 )
    if(  true > 1 )
    if(     1 > 1 )
    if(     false )
    
BinarySchool
43
BinarySchool  
if(Buy Condition Come true) //buy
   {
     static double LastAsk=Ask;
     double CurrentAsk=Bid;
    
    
    if(CurrentAsk<LastAsk)
      {
        LastAsk=CurrentAsk;
      }
     if(CurrentAsk>(LastAsk+2*Point))
     { 
        tkt=OrderSend(Symbol(),OP_BUY,Lots,NormalizeDouble(Ask,Digits),0,0,0,"BO exp:"+IntegerToString(BOExpiry*60),0,0,clrGreen);
     }  
   } 
   
   if(Sell Condition Come true)//Sell
   {
      static double LastBid=Bid;
      double CurrentBid=Ask;
       
 
      if(CurrentBid>LastBid)
      {
         LastBid=CurrentBid;
      }
     if(CurrentBid<(LastBid-2*Point))
      { 
         tkt=OrderSend(Symbol(),OP_SELL,Lots,NormalizeDouble(Bid,Digits),0,0,0,"BO exp:"+IntegerToString(BOExpiry*60),0,0,clrRed);
      }  
   }
To add comments, please log in or register