Identifying Candles

 

I'm trying to identify candles where, a buy candle has more selling than buying, and a sell candle has more buying than selling.  I have the values , but drawing the arrows to mark the candle is a bit of a problem.  The following code is suppose to draw a green down arrow, on the high ,of a sell candle, when there's more increases in the close price, than decreases; a white down candle when there's more decreases in the close price, than increases; and a yellow when there is only decreases.


  For a buy candle, a red down arrow, when there's more decreases in the close price, than increases; a white down candle when there's more increases  than decreases; and a yellow when there is only increases.


  The code instead, is drawing a red up candle for each condition.  I realize that there can be more than one arrow drawn on a candle due to changes in conditions.  That's o.k. for now, I can deal with that later.  Just trying to get the right candle to be drawn first.  Not sure what I'm doing wrong.

Thanks!

vO = 5 min Open,  vC = 5 min Close,  dB = increase in Close, dS = decrease in Close

         if( vO > vC && dB < dS && dB != 0 )
         {
         ObjectCreate("UpASymbl"+Time[0], OBJ_ARROW, 0, Time[0],High[0]);       
         ObjectSet("UpASymbl", OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);            
         ObjectSet("UpASymbl", OBJPROP_COLOR, White);                           
         }

         if( vO > vC && dB > dS && dS != 0 )
         {
         ObjectCreate("UpBSymbl"+Time[0], OBJ_ARROW, 0, Time[0],High[0]);       
         ObjectSet("UpBSymbl", OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);             
         ObjectSet("UpBSymbl", OBJPROP_COLOR, Lime);                            
         }

         if( vO > vC && dB == 0 )
         {
         ObjectCreate("UpCSymbl"+Time[0], OBJ_ARROW, 0, Time[0],High[0]);        
         ObjectSet("UpCSymbl", OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);             
         ObjectSet("UpCSymbl", OBJPROP_COLOR, Yellow);                             
         }



         if( vO < vC && dB > dS && dS != 0 )
         {
         ObjectCreate("DwnASymbl"+Time[0] , OBJ_ARROW, 0, Time[0],High[0]);              
         ObjectSet("DwnASymbl", OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);             
         ObjectSet("DwnASymbl", OBJPROP_COLOR, White);                             
         }
         
         
         if( vO < vC && dB < dS && dB != 0 )
         {
         ObjectCreate("DwnBSymbl"+Time[0] , OBJ_ARROW, 0, Time[0],High[0]);               
         ObjectSet("DwnBSymbl", OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);             
         ObjectSet("DwnBSymbl", OBJPROP_COLOR, Red);                              
         }   
         
         
         if( vO < vC && dS == 0 )
         {
         ObjectCreate("DwnCSymbl"+Time[0] , OBJ_ARROW, 0, Time[0],High[0]);              
         ObjectSet("DwnCSymbl", OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);            
         ObjectSet("DwnCSymbl", OBJPROP_COLOR, Yellow);                             
         }    

 
Print your variables before each if, and add a print statement inside each if, and find out why.
 

I figured it out.  Had to change a few things and give each object it's own name.  That way there are no conflicts.


         if( vO > vC && dB < dS && dB != 0 )
         {
         ObjectCreate(StringConcatenate("UpASymblA",TimeCurrent()), OBJ_ARROW, 0, Time[0],vH);         
         ObjectSet(StringConcatenate("UpASymblA",TimeCurrent()), OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);              
         ObjectSet(StringConcatenate("UpASymblA",TimeCurrent()), OBJPROP_COLOR, Yellow);                             
         }

         if( vO > vC && dB > dS && dS != 0 )
         {
         ObjectCreate(StringConcatenate("UpBSymblB",TimeCurrent()), OBJ_ARROW, 0, Time[0],vH);           
         ObjectSet(StringConcatenate("UpBSymblB",TimeCurrent()), OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);             
         ObjectSet(StringConcatenate("UpBSymblB",TimeCurrent()), OBJPROP_COLOR, Lime);                             
         }

         if( vO > vC && dB == 0 )
         {
         ObjectCreate(StringConcatenate("UpCSymblC",TimeCurrent()), OBJ_ARROW, 0, Time[0],vH);          
         ObjectSet(StringConcatenate("UpCSymblC",TimeCurrent()), OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);             
         ObjectSet(StringConcatenate("UpCSymblC",TimeCurrent()), OBJPROP_COLOR, Blue);                             
         }


         if( vO > vC && dB == dS )
         {
         ObjectCreate(StringConcatenate("UpDSymblD",TimeCurrent()), OBJ_ARROW, 0, Time[0],vH);         
         ObjectSet(StringConcatenate("UpDSymblD",TimeCurrent()), OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);              
         ObjectSet(StringConcatenate("UpDSymblD",TimeCurrent()), OBJPROP_COLOR, White);                              
         }




Would like to know how to change arrow to a dot, though.


Thanks!

 
Yellowbeard: Would like to know how to change arrow to a dot, though.
Don't double post. Previously asked and answered