Problem Calculating the difference between prices of a candle MQL4

 

Hi, I need help with this


I'm trying to calculate the price of the previous candle in order to set the Stop Loss and Take Profit for a Order Send. The problem is I can make the decimals into a number of pips.


If someone could help me with this, I will appreciate that

//---- Valores de Mechas-----------------------------------------+
            
                  low_1=Low[1];
                  low_2=Low[2];
                  high_1=High[1];
                  high_2=High[2];
                  open_1=Open[1];
                  open_2=Open[2];
                  close_1=Close[1];
                  close_2=Close[2];
                  diff_1 = low_2 - low_1;
                  diff_2 = high_2 - high_1;
                  PP_B=close_1-low_1;
                  PP_B=PP_B * 1000;
                  PP_S=high_1-close_1;
                  PP_S=PP_S * 1000;
            
            //---- Señal de Compra ------------------------------------------+
            if(
                diff_1 <= 0.02 && diff_1>=0
                && open_1 < close_1
                && open_2 > close_2
                && Hour() >= 0
                && Hour() <= 23
               )
                
              {
                  counter=counter+1;
                  name1="Arrow_Up"+counter;
                  Alert (diff_1);
                  Alert("Mechas Iguales en Compra ", Symbol(), " Precio 1: ", low_1, "/ Precio 2: ", low_2, " - Diferencia: ", diff_1);
                  OrderSend(Symbol(),OP_BUY,5,Ask*Point,20,Ask-(PP_B+50)*Point,Ask+(PP_B+50)*Point);
                  ObjectCreate(0,name1,OBJ_ARROW_UP,0,Time[0],(Low[1]-50*Point)); 
                  ObjectSetInteger(0, name1, OBJPROP_COLOR, Black); 
                  ObjectSetInteger(0,name1,OBJPROP_WIDTH,10); 
                    
                      
              }  
 
Samuel6495:

Hi, I need help with this


I'm trying to calculate the price of the previous candle in order to set the Stop Loss and Take Profit for a Order Send. The problem is I can make the decimals into a number of pips.


If someone could help me with this, I will appreciate that

Why would you need to?

//Ask-(PP_B+50)*Point,Ask+(PP_B+50)*Point);
Ask-(PP_B+50*Point),Ask+(PP_B+50*Point));
Reason: