help with code counting types of order please ?

 

I am trying to get this code to count the different types of order and store the results where I can use them, but it doesnt work. Could anyone help ?

double    Op_Buy,  Op_Sell, Op_BuyStop, Op_SellStop,   Op_BuyLimit,   Op_SellLimit   ;
   int      total         = OrdersTotal();
      
   for(int a=1; a<=total; a++)          // Loop through orders
         {
         if (OrderSelect(a,SELECT_BY_POS)==true) // If there is the next one
         {                                       // changed a-1 to a in that OrderSelect
         OrderSelect( SELECT_BY_POS , MODE_TRADES );
         double   type          = OrderType();
         switch(type)
         {
         case OP_BUY       : Op_Buy       = Op_Buy + 1 ;
         case OP_SELL      : Op_Sell      = Op_Sell + 1 ;
         case OP_BUYSTOP   : Op_BuyStop   = Op_BuyStop + 1 ;
         case OP_SELLSTOP  : Op_SellStop  = Op_SellStop + 1 ;
         }
      }
   }
//|--------------------------------------------------------------------- comments
   string  Open_Buy_positions             = DoubleToStr(Op_Buy,0);
   string  Open_BuyStop_positions         = DoubleToStr(Op_BuyStop,0);
   string  Open_Sell_positions            = DoubleToStr(Op_Sell,0);
   string  Open_SellStop_positions        = DoubleToStr(Op_SellStop,0);
   string  WOPs                           = DoubleToStr(Entry,5);
   Comment( 
   "Weekly Open Price         = ",  WOPs,                      "\n",
   "TEST - Op_Buys            = ",  Open_Buy_positions,          "\n",
   "TEST - Op_Buystops        = ",  Open_BuyStop_positions,      "\n",          
   "TEST - Op_Sells           = ",  Open_Sell_positions,         "\n",
   "TEST - Op_SellsStops      = ",  Open_SellStop_positions,     "\n" 
   );
   
 



double Op_Buy = 0;
double Op_Sell = 0;
double Op_BuyStop = 0;
double Op_SellStop = 0;
double Op_BuyLimit = 0;
double Op_SellLimit = 0;


for(int a=0; a < OrdersTotal() ; a++){ // Loop through orders

if (OrderSelect(a,SELECT_BY_POS)) // If there is the next one
{
// I usually perform a check on whether the order is on the current chart and with the current EA and stuff, but i guess you're not interested in that.
int type = OrderType();
switch(type)
{
case OP_BUY : Op_Buy++; break;
case OP_SELL : Op_Sell++; break;
case OP_BUYSTOP : Op_BuyStop++; break;
case OP_SELLSTOP : Op_SellStop++; break;
}
}
}
//|--------------------------------------------------------------------- comments
string Open_Buy_positions = DoubleToStr(Op_Buy,0);
string Open_BuyStop_positions = DoubleToStr(Op_BuyStop,0);
string Open_Sell_positions = DoubleToStr(Op_Sell,0);
string Open_SellStop_positions = DoubleToStr(Op_SellStop,0);
string WOPs = DoubleToStr(Entry,5);
Comment( StringConcatenate(
"Weekly Open Price = ", WOPs, "\n",
"TEST - Op_Buys = ", Open_Buy_positions, "\n",
"TEST - Op_Buystops = ", Open_BuyStop_positions, "\n",
"TEST - Op_Sells = ", Open_Sell_positions, "\n",
"TEST - Op_SellsStops = ", Open_SellStop_positions, "\n"
));

// Double entry = 0; is not defined anywhere.

 

Email sent

 

can someone help me edit sar ohlc to use heiken ashi ohlc

Hi, I have an MTF indicator that uses sar, however I'd like the sar to calculate heiken ashi ohlc, and not the normal type

Can you tell me how I can do this, my mtf indicator calls to the sar indicator to calculate sar formula, I think it is calling to the internal indicator in mt4 that can not edit

you can skype or email if you can assist and like to talk about it

skype sty671

email sty671@gmail.com

I can also supply the original file that I'm trying to use heiken ashi ohlc for

 
sty671:

can someone help me edit sar ohlc to use heiken ashi ohlc

https://www.mql5.com/en/forum/132964
 

StringConcatenate

thankyou

Reason: