Orders Execution
0
Views
0
Downloads
0
Favorites
Profitability Reports
AUD/USD
Oct 2024 - Jan 2025
8.00 %
Total Trades
201
Won Trades
0
Lost trades
0
Win Rate
0.00 %
Expected payoff
-4.54
Gross Profit
81.80
Gross Loss
-994.50
Total Net Profit
-912.70
-100%
-50%
0%
50%
100%
GBP/USD
Oct 2024 - Jan 2025
75.00 %
Total Trades
192
Won Trades
98
Lost trades
94
Win Rate
0.51 %
Expected payoff
-0.61
Gross Profit
359.50
Gross Loss
-476.70
Total Net Profit
-117.20
-100%
-50%
0%
50%
100%
Mandor
// Ñòàðòîâûé ïåðèîä.mq4
// © 2003-2006 Mandor ®
// E-mail: mandorr@gmail.com
// Èñïîëüçóåòñÿ òîëüêî ïåðèîä H1
// Ïåðâûé ñòàðòîâûé ïåðèîä 05-08 GMT, îòëîæåííûå îðäåðà óñòàíàâëèâàþòñÿ â 09 GMT
// Âòîðîé ñòàðòîâûé ïåðèîä 09-12 GMT, îòëîæåííûå îðäåðà óñòàíàâëèâàþòñÿ â 13 GMT
// Îòëîæåííûå îðäåðà óñòàíàâëèâàþòñÿ â òå÷åíèè ÷àñà òîëüêî 1 ðàç
// LossFree: ïðèáûëü, ïðè êîòîðîé ñòîï ëîññ ïåðåäâèãàåòñÿ â òî÷êó áåçóáûòî÷íîñòè
// ShiftGMT: âðåìÿ òîðãîâîãî ñåðâåðà - âðåìÿ ïî Ãðèíâè÷ó
extern double Lots = 0.1;
// Äëÿ GBPUSD
// extern int TakeProfit = 120;
// extern int StopLoss = 70;
// extern int LossFree = 40;
// Äëÿ EURUSD
extern int TakeProfit = 80;
extern int StopLoss = 50;
extern int LossFree = 30;
extern int ShiftGMT = 1;
extern int MinStop = 11;
int nBuyStopSetting;
int nSellStopSetting;
// Îñíîâíàÿ ôóíêöèÿ
// Âûçûâàåòñÿ ïîñëå ïðèõîäà î÷åðåäíîãî òèêà
void start()
{
if (Bars<100 || IsTradeAllowed()==false || Period()!=PERIOD_H1) return;
if (ShiftGMT<-23 || ShiftGMT>23) return;
int nTime=Time[0]-ShiftGMT*3600;
int nHour=TimeHour(nTime);
int nDayOfWeek=TimeDayOfWeek(nHour);
if (nDayOfWeek==5) {if (nHour==22 || nHour<9) {CloseOrders(); return;}}
else {if (nHour==23 || nHour<9) {CloseOrders(); return;}}
if (SetStopLoss() >0) return;
if (SetTakeProfit()>0) return;
if (nHour==9 || nHour==13) SetOrders();
else {nBuyStopSetting=0; nSellStopSetting=0;}
}
// Çàêðûòèå âñåõ îðäåðîâ
void CloseOrders()
{
int i, nTicket, nPrice, nSlippage;
double dLots;
nTicket=0; dLots=0; nPrice=0; nSlippage=2;
for(i=0;i<OrdersTotal();i++)
{
if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if (OrderSymbol()!=Symbol()) continue;
if (OrderType()==OP_BUY ) {nTicket=OrderTicket(); dLots=OrderLots(); nPrice=MathRound(Bid/Point); break;}
if (OrderType()==OP_SELL) {nTicket=OrderTicket(); dLots=OrderLots(); nPrice=MathRound(Ask/Point); break;}
}
if (nTicket>0) {OrderClose(nTicket,dLots,nPrice*Point,nSlippage); return;}
for(i=0;i<OrdersTotal();i++)
{
if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if (OrderSymbol()!=Symbol()) continue;
if (OrderType()==OP_BUYSTOP ) {nTicket=OrderTicket(); break;}
if (OrderType()==OP_SELLSTOP) {nTicket=OrderTicket(); break;}
}
if (nTicket>0) OrderDelete(nTicket);
}
// óñòàíîâêà ñòîï ëîññ îðäåðîâ Buy è Sell
int SetStopLoss()
{
int i, nPrice, nBid, nAsk, nOrderType, nTicket, nOpenPrice, nStopLoss, nTakeProfit;
nTicket=0;
for (i=0;i<OrdersTotal();i++)
{
if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if (OrderSymbol()!=Symbol()) continue;
nOrderType=OrderType();
if (nOrderType==OP_BUY || nOrderType==OP_SELL)
{
nTicket=OrderTicket();
nOpenPrice=MathRound(OrderOpenPrice()/Point);
nStopLoss=MathRound(OrderStopLoss()/Point);
nTakeProfit=MathRound(OrderTakeProfit()/Point);
break;
}
}
if (nTicket==0) return(0);
nPrice=nStopLoss;
if (nOrderType==OP_BUY)
{
nBid=MathRound(Bid/Point);
if (nBid>nOpenPrice+LossFree)
{if (nStopLoss<nOpenPrice) nPrice=nOpenPrice;}
else if (nBid>nOpenPrice-StopLoss+MinStop)
{if (nStopLoss<nOpenPrice-StopLoss) nPrice=nOpenPrice-StopLoss;}
else
{if (nStopLoss<nBid-MinStop) nPrice=nBid-MinStop;}
}
else if (nOrderType==OP_SELL)
{
nAsk=MathRound(Ask/Point);
if (nAsk<nOpenPrice-LossFree)
{if (nStopLoss==0 || nStopLoss>nOpenPrice) nPrice=nOpenPrice;}
else if (nAsk<nOpenPrice+StopLoss-MinStop)
{if (nStopLoss==0 || nStopLoss>nOpenPrice+StopLoss) nPrice=nOpenPrice+StopLoss;}
else
{if (nStopLoss==0 || nStopLoss>nAsk+MinStop) nPrice=nAsk+MinStop;}
}
if (nStopLoss==nPrice) return(0);
OrderModify(nTicket,nOpenPrice*Point,nPrice*Point,nTakeProfit*Point,0);
return(nTicket);
}
// óñòàíîâêà òàéê ïðîôèò îðäåðîâ Buy è Sell
int SetTakeProfit()
{
int i, nPrice, nBid, nAsk, nOrderType, nTicket, nOpenPrice, nStopLoss, nTakeProfit;
nTicket=0;
for (i=0;i<OrdersTotal();i++)
{
if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if (OrderSymbol()!=Symbol()) continue;
nOrderType=OrderType();
if (nOrderType==OP_BUY || nOrderType==OP_SELL)
{
nTicket=OrderTicket();
nOpenPrice=MathRound(OrderOpenPrice()/Point);
nStopLoss=MathRound(OrderStopLoss()/Point);
nTakeProfit=MathRound(OrderTakeProfit()/Point);
break;
}
}
if (nTicket==0) return(0);
nPrice=nTakeProfit;
if (nOrderType==OP_BUY)
{
nAsk=MathRound(Ask/Point);
if (nAsk<nOpenPrice+TakeProfit-MinStop)
{if (nTakeProfit>nOpenPrice+TakeProfit) nPrice=nOpenPrice+TakeProfit;}
else
{if (nTakeProfit>nAsk+MinStop) nPrice=nAsk+MinStop;}
}
else if (nOrderType==OP_SELL)
{
if (nBid>nOpenPrice-TakeProfit+MinStop)
{if (nTakeProfit<nOpenPrice-TakeProfit) nPrice=nOpenPrice-TakeProfit;}
else
{if (nTakeProfit<nBid-MinStop) nPrice=nBid-MinStop;}
}
if (nTakeProfit==nPrice) return(0);
OrderModify(nTicket,nOpenPrice*Point,nStopLoss*Point,nPrice*Point,0);
return(nTicket);
}
// Óñòàíîâêà è êîððåêòèðîâêà îòëîæåííûõ îðäåðîâ
void SetOrders()
{
int nBid, nAsk, nSpread;
int nTicket, nOpenPrice, nMagic;
int nHighStop, nLowStop, nPrice;
int i;
string sText;
nMagic=TimeHour(Time[0]);
// êîëè÷åñòâî îðäåðîâ òåêóùåãî ÷àñà
int nTotalBuyStop=0,nTotalSellStop=0;
for (i=0;i<OrdersTotal();i++)
{
if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if (OrderSymbol()!=Symbol()) continue;
if (OrderMagicNumber( )!=nMagic) continue;
{
if (OrderType()==OP_BUYSTOP) nTotalBuyStop++;
if (OrderType()==OP_SELLSTOP) nTotalSellStop++;
}
}
// óðîâíè äëÿ îòëîæåííûõ îðäåðîâ
nAsk=MathRound(Ask/Point);
nBid=MathRound(Bid/Point);
nSpread=nAsk-nBid;
nHighStop=MathRound(High[Highest(NULL,0,MODE_HIGH,4,1)]/Point)+nSpread;
nLowStop =MathRound(Low [Lowest (NULL,0,MODE_LOW ,4,1)]/Point);
nHighStop=nHighStop+5;
nLowStop =nLowStop -5;
if (nTotalBuyStop==0)
{
// óñòàíîâêà îðäåðà Buy Stop
if (nBuyStopSetting>0) return;
nPrice=nHighStop; if (nHighStop<nAsk+MinStop) nPrice=nAsk+MinStop;
sText="Open in "+DoubleToStr(nMagic,0)+" hour";
nTicket=OrderSend(Symbol(),OP_BUYSTOP,Lots,nPrice*Point,0,0,0,sText,nMagic,0);
return;
}
else
{
nBuyStopSetting=1;
// êîððåêòèðîâêà öåíû îðäåðîâ Buy Stop
nPrice=nHighStop; if (nHighStop<nAsk+MinStop) nPrice=nAsk+MinStop;
nTicket=0;
for (i=0;i<OrdersTotal();i++)
{
if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if (OrderSymbol()!=Symbol()) continue;
if (OrderType()!=OP_BUYSTOP) continue;
nOpenPrice=MathRound(OrderOpenPrice()/Point);
if(nOpenPrice<=nPrice) continue;
nTicket=OrderTicket();
break;
}
if (nTicket>0)
{
OrderModify(nTicket,nPrice*Point,0,0,0);
return;
}
}
if (nTotalSellStop==0)
{
// óñòàíîâêà îðäåðà Sell Stop
if (nSellStopSetting>0) return;
nPrice=nLowStop; if (nLowStop>nBid-MinStop) nPrice=nBid-MinStop;
sText="Open in "+DoubleToStr(nMagic,0)+" hour";
nTicket=OrderSend(Symbol(),OP_SELLSTOP,Lots,nPrice*Point,0,0,0,sText,nMagic,0);
return;
}
else
{
// êîððåêòèðîâêà öåíû îðäåðîâ Sell Stop
nSellStopSetting=1;
nPrice=nLowStop; if (nLowStop>nBid-MinStop) nPrice=nBid-MinStop;
nTicket=0;
for (i=0;i<OrdersTotal();i++)
{
if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if (OrderSymbol()!=Symbol()) continue;
if (OrderType()!=OP_SELLSTOP) continue;
nOpenPrice=MathRound(OrderOpenPrice()/Point);
if(nOpenPrice>=nPrice) continue;
nTicket=OrderTicket();
break;
}
if(nTicket>0)
{
OrderModify(nTicket,nPrice*Point,0,0,0);
return;
}
}
}
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---