[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 375

 
artmedia70:
Time[number_bar];

Thank you! I'll try to prescribe it :)
 
nemo811:
Have you considered the price at which your orders are opened (Ask or Bid)?

I told you to open the order at the same price, but it is opened 1-2 pips later.
 
myrzila:

I'm telling you, I prescribe an order to be opened at the same price and it opens 1-2 pips later.

Yes, some brokerage companies may use positions with slippage. I did not believe in it myself until I saw it with my own eyes. At that time my friend and I were scalping in one of brokerage companies. The deal lasted in the market for no more than a minute and was immediately closed. Since the vast majority of transactions were closed in the plus, it was not profitable for brokerage companies. This brokerage company paid us what we earned and introduced slippage on pending orders and slippage on triggering of stop-orders that killed all our trades. That's how it happens. So, contact your brokerage company and ask them why you do not open orders at the price at which they are set.
 

Good afternoon!

Back to a question I couldn't figure out on my own. How can I programmatically determine deposits/withdrawals for a specific period?

That is, if you take the trading period of November 25 and go through all the orders for that time, you can determine deposits/withdrawals for that period. And here's the question: how do you calculate?

extern string            DayX="25.11.2011 00:00";   

if(TimeCurrent()>StrToTime(DayX)) //если текущее время старше момента начала периода
     {
      for(i=0; i<StrToTime(OrdersHistoryTotal()); i++)
       {
         if(OrderOpenTime()<StrToTime(DayX)) continue;
         if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY) && OrderType()==6)
          {
            jjjj=+ //а вот здесь загвоздка, что-же суммировать? профит по OrderType()==6????????
          }
       }
     }
 
forexnew:

Good afternoon!

Back to a question I couldn't figure out on my own. How can I programmatically determine deposits/withdrawals for a specific period?

That is, if you take the trading period of November 25 and go through all the orders for that time, you can determine deposits/withdrawals for that period. And here's the question: how do you calculate?


If OrderProfit() is greater than zero - add, less - withdraw
 
Vinin:

If OrderProfit() is greater than zero - fill, less - withdrawal

Thank you! I.e. it is possible to determine which fills and withdrawals were separate?!

extern string            DayX="25.11.2011 00:00";   

if(TimeCurrent()>StrToTime(DayX)) //если текущее время старше момента начала периода
     {
      for(i=0; i<StrToTime(OrdersHistoryTotal()); i++)
       {
         if(OrderOpenTime()<StrToTime(DayX)) continue;
         if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY) && OrderType()==6 && OrderProfit()>0)
          {
            Profit1=+OrderProfit(); //доливки
          }

         if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY) && OrderType()==6 && OrderProfit()<0)
          {
            Profit2=+OrderProfit(); //снятия          
          }
       }
     }
 

Why does the maximum lot calculation function return "0" for instrument #DD ? This does not always happen.

double MaxmaxLots(int cmd) 
{
    double result = 0;
    double lotStep = MarketInfo(SymbolMax[nnnn], MODE_LOTSTEP);
    double v = MarketInfo(SymbolMax[nnnn], MODE_MINLOT);
    double mult = 100;
    
    while (true) {
        if (AccountFreeMarginCheck(SymbolMax[nnnn], cmd, v + lotStep * mult) > 0) { 
            v = v + lotStep * mult;
        } else {
            mult = mult / 10;
            
            if (mult < 1) {
                if (AccountFreeMarginCheck(SymbolMax[nnnn], cmd, v) > 0) {  
                    result = v;
                }
                break;
            }
        }
    }
    
    return(result);
}    
 
forexnew:

Thank you! I.e. it is possible to identify which refills and removals were individually!


extern string            DayX="25.11.2011 00:00";   

if(TimeCurrent()>StrToTime(DayX)) //если текущее время старше момента начала периода
     {
      for(i=0; i<StrToTime(OrdersHistoryTotal()); i++)
       {
         if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)=false) continue;
         if(OrderOpenTime()<StrToTime(DayX)) continue;
         if(OrderType()!=6) continue;

         if(OrderProfit()>0)
          {
            Profit1=+OrderProfit(); //доливки
          }
         else 
          {
            Profit2=+OrderProfit(); //снятия          
          }
       }
     }
 
int start()

  {
  DrowDownAlert=iCustom(NULL, 0, "Equity_v7",4,0);  
   

 double a=TotalLots(0);
 double b=TotalLots(1);
  Comment (a,b);
  return(0);
  }

//----------------------- подсчёт объема позиций----------------------------//
void TotalLots(bool zet)
{
   double total=0,total1=0;
   int slippage=20;
   for (int i=OrdersTotal()-1; i>=0; i--)
   {
      if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) break;
      if (OrderType()==OP_BUY ) total=total+OrderLots();
      if (OrderType()==OP_SELL) total1=total1+OrderLots();
   }
 if (zet==0) return (total); else return (total1) ;  
 
}
Why does the errork output that the function return has a null result, what is the error???
 
nikelodeon:
Why does the errork output that the function return has a null result, what is the error???

//----------------------- подсчёт объема позиций----------------------------//
int TotalLots(bool zet)
{
   double total=0,total1=0;
   int slippage=20;
   for (int i=OrdersTotal()-1; i>=0; i--)
   {
      if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) break;
      if (OrderType()==OP_BUY ) total=total+OrderLots();
      if (OrderType()==OP_SELL) total1=total1+OrderLots();
   }
 if (zet==0) return (total); else return (total1) ;  
 
}
Reason: