[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 593

 
chief2000:

When testing and optimising, we most often use one currency pair, get an acceptable profit, and a drawdown. Then we repeat it for other currencies. But in the end an Expert Advisor will have to trade all currencies we are interested in from one trading account. They say that the expected "total" drawdown can be better than the drawdown obtained for each currency individually (I've seen this opinion several times somewhere). But it can be much worse if several Expert Advisors enter a losing streak at the same time.

I am also interested in traders' experience on this subject. I would like to offer a very interesting video clip by Seaboss

http://taverno.livejournal.com/2010/04/10/ Total Equity Management in Seaboss is implemented for Omega, are there similar implementations for MT?

 
Good evening, dear forum members! I contacted in the afternoon, no one has responded - I need an indicator that displays vertical hour lines in the terminal window, surely there is a ready-made one, advise where to get one?
 
root:
Good evening, dear forum members! I contacted them during the day but no one has reacted - I need an indicator that displays vertical hour lines in the terminal window, surely there is a ready-made one, could you tell me where to get it?

I don't know where to get it. Probably the reason why I haven't heard any replies is that it's a simple thing to write such an indicator and no one will probably need it.
 

vik-777:

Help me solve this problem

doing a sampling of all closed positions

for (int i=0; i<OrdersHistoryTotal(); i++)
if(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)==true)

afterwards filter by magic number

if (OrderMagicNumber()==12)

the filter matches 3 positions but I need only the last one closed by a magic number

I can not figure out how to leave only the last one?

Thank you

Can someone help me no one has faced
 
vik-777:
Can someone help me? Hasn't anyone come across this?

OrderCloseTime() to help you
 
Figar0:

OrderCloseTime() to help you
so what? i can use it to find the last closed order and i need the last closed order with a magician. tell me how can i compare multiple orders using OrderCloseTime()?
 
vik-777:
So what? I can find the last closed order and I need the last closed order with a magician, tell me how to do a comparison of multiple orders by OrderCloseTime()?

int LastClose =0;
int LastTicket;
for (int i=0; i<OrdersHistoryTotal(); i++)
{
  if(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)==true)
  {
    if (OrderMagicNumber()==12)
    {
      if (OrderCloseTime()>LastClose)
      {
        LastClose=OrderCloseTime();
        LastTicket=OrderTicket();
      }
    }
  }
}

if (LastClose>0)
{
  if(OrderSelect(LastTicket, SELECT_BY_TICKET, MODE_HISTORY)==true)
  {
  //// Тра-та-та
  }
}
It's too crude and straightforward. It can be more beautiful and laconic...
 
Figar0:

Rooty-tooty and in the forehead. It could be prettier and more succinct...
Thank you very much. Much obliged.
 
Craft:

I am also interested in traders' experience on this subject. I would like to suggest a very interesting video clip by Seaboss

http://taverno.livejournal.com/2010/04/10/ Seaboss has implemented Equity Management for Omega, are there similar implementations for MT?

Here's something I found (haven't read it yet, but it seems to be on topic)

https://www.mql5.com/ru/forum/125825

 

Vopshchem I took probability theory and statistically if order's margin will be in a radius of 50 pips from the price, then at opening order with a profit of 10 pips is easier to reach - if there is also a stop loss of 10 pips (even the spread is not a problem) the movement of a trend is a great thing ...

Add a stop loss, regardless of StepStop

//+------------------------------------------------------------------+
//| Volfram.mq4 |
//| Vova-x@list.ru |
//| |
//+------------------------------------------------------------------+
#property copyright "Vova-x@list.ru"
#property link ""
//-----------------------------------------
extern TakeProfit=10;
extern int StepStop=45;
extern double Lots=0.01;
extern bool MoneyManagement=true;
extern inttern MarginPercent=10;
//-------------------------------------------
int level_sell_stop;
int level_buy_stop;

//----------------------------------------------------------
void init()
{
// int minstop=MarketInfo(Symbol(),MODE_STOPLEVEL);
//Print("levelbuy_stop: "+minstop;)
}
//-----------------------------------------------------------
void start()
{
if (!IsTradeAllowed()) return;
level_buy_stop=0;
level_sell_stop=0;
StepingStop();
StepingPendings();
if (TotalBuy ()==0 && TotalBuyStop ()==0) SetBuyStop ();
if (TotalSell()==0 && TotalSellStop()==0) SetSellStop();
Comment("Level Buy Stop=",level_buy_stop*Point,
"\n", "Level Sell Stop=",level_sell_stop*Point);
}
//---------------------------------------------------------------------------------------------
void StepingStop()
{
if (StepStop<1) return;
int ask, bid, open, stop, x;
double loss;
for (int i=0; i<OrdersTotal(); i++)
{
if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) break;
if (OrderSymbol()!=Symbol())
if (OrderType()==OP_BUY)
{
bid=MathRound(Bid/Point);
open=MathRound(OrderOpenPrice()/Point);
stop=MathRound(OrderStopLoss()/Point);
x=(bid-open)/StepStop; x--; x*=StepStop;
level_sell_stop=open+x;
if (stop>=open+x)
loss=(open+x)*Point;
OrderModify(OrderTicket(),OrderOpenPrice(),loss,OrderTakeProfit(),0,CLR_NONE);
}
if (OrderType()==OP_SELL)
{
ask=MathRound(Ask/Point);
open=MathRound(OrderOpenPrice()/Point);
stop=MathRound(OrderStopLoss()/Point);
x=(open-ask)/StepStop; x--; x*=StepStop;
level_buy_stop=open-x;
if (stop>0 && stop<=open-x)
loss=(open-x)*Point;
OrderModify(OrderTicket(),OrderOpenPrice(),loss,OrderTakeProfit(),0,CLR_NONE);
}
}
}
//----------------------------------------------------------------------------
void StepingPendings()
{
int ask, bid, open;
double price, loss, profit;
for (int i=0; i<OrdersTotal(); i++)
{
if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) break;
if (OrderSymbol()!=Symbol())
if (OrderType()==OP_BUYSTOP)
{
if (level_buy_stop==0)
open=MathRound(OrderOpenPrice()/Point);
if (open<=level_buy_stop)
price=level_buy_stop*Point;
loss=price-StepStop*Point;
profit=0; if (TakeProfit>0) profit=price+TakeProfit*Point;
OrderModify(OrderTicket(),price,loss,profit,0,CLR_NONE);
}
if (OrderType()==OP_SELLSTOP)
{
if (level_sell_stop==0)
open=MathRound(OrderOpenPrice()/Point);
if (open>=level_sell_stop)
price=level_sell_stop*Point;
loss=price+StepStop*Point;
profit=0; if (TakeProfit>0) profit=price-TakeProfit*Point;
OrderModify(OrderTicket(),price,loss,profit,0,CLR_NONE);
}
}
}
//-------------------------------------------------------------------
void SetBuyStop()
{
double lots=LotsCounting();
double price=Bid+StepStop*Point;
double loss=price-StepStop*Point;
double profit=0; if (TakeProfit>0) profit=price+TakeProfit*Point;
int ticket=OrderSend(Symbol(),OP_BUYSTOP,lots,price,0,loss,profit,"",0,0,CLR_NONE);
if (ticket<1) Print("Set a pending order failed with error #",GetLastError()," ",(GetLastError());
}

void SetSellStop()
{
double lots=LotsCounting();
double price=Ask-StepStop*Point;
double loss=price+StepStop*Point;
double profit=0; if (TakeProfit>0) profit=price-TakeProfit*Point;
int ticket=OrderSend(Symbol(),OP_SELLSTOP,lots,price,0,loss,profit,"",0,0,CLR_NONE);
if (ticket<1) Print("Set a pending order failed with error #",GetLastError()," ",(GetLastError());
}


int TotalBuy()
{
int count=0;
for (int i=0; i<OrdersTotal(); i++)
{
if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) break;
if (OrderSymbol()!=Symbol()) continue;
if (OrderType()==OP_BUY) count++;
}
return (count);
}

int TotalBuyStop()
{
int count=0;
for (int i=0; i<OrdersTotal(); i++)
{
if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) break;
if (OrderSymbol()!=Symbol()) continue;
if (OrderType()==OP_BUYSTOP) count++;
}
return (count);
}

int TotalSell()
{
int count=0;
for (int i=0; i<OrdersTotal(); i++)
{
if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) break;
if (OrderSymbol()!=Symbol()) continue;
if (OrderType()==OP_SELL) count++;
}
return (count);
}

int TotalSellStop()
{
int count=0;
for (int i=0; i<OrdersTotal(); i++)
{
if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) break;
if (OrderSymbol()!=Symbol()) continue;
if (OrderType()==OP_SELLSTOP) count++;
}
return (count);
}

double LotsCounting()
{
double lots=Lots;
if (MoneyManagement)
{
double lotsize=MarketInfo(Symbol(),MODE_LOTSIZE);
double freemargin=AccountFreeMargin();
lots=0; if (lotsize>0) lots=NormalizeDouble((MarginPercent*freemargin/lotsize),1);
}
if (lots>10) lots=NormalizeDouble(lots,0);
if (lots<0.01) lots=0.01;
return (lots);
}


// End

Reason: