#property version "1.10"
#property strict
#include <stdlib.mqh>
enum TrType { Buy=0, Sell=1 };
input double Lots = 1;
input int TargetPips = 10;
input int Slippage = 3;
input int Magic = 332255;
input int CoolingTime = 5;
input string Suffix = "";
input string Pair1 = "AUDUSD";
input TrType TradeType1 = Sell;
input string Pair2 = "USDCAD";
input TrType TradeType2 = Buy;
input string Pair3 = "USDJPY";
input TrType TradeType3 = Buy;
int TotalCount = 0;
int Slip;
bool CloseAll;
int DigFactor = 1;
datetime TradeStart;
int OnInit()
{
// код доступен только после оплаты
}
void OnDeinit(const int reason)
{
}
void OnTick()
{
// код доступен только после оплаты
}
double BidPrice=0, AskPrice=0;
double PipsProfit=0;
double MyPoin;
TotalCount = 0;
for (int i=0; i<OrdersTotal(); i++)
{
if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if (OrderMagicNumber() == Magic && (OrderSymbol() == Pair1+Suffix || OrderSymbol() == Pair2+Suffix || OrderSymbol() == Pair3+Suffix))
{
TotalCount++;
BidPrice = MarketInfo(OrderSymbol(),MODE_BID);
AskPrice = MarketInfo(OrderSymbol(),MODE_ASK);
MyPoin = MarketInfo(OrderSymbol(),MODE_POINT)*DigFactor;
if (OrderType() == OP_BUY)
{
PipsProfit += (BidPrice-OrderOpenPrice())/MyPoin;
}
if (OrderType() == OP_SELL)
{
PipsProfit += (OrderOpenPrice()-AskPrice)/MyPoin;
}
}
}
}
if (PipsProfit > TargetPips)
{
CloseAll = true;
}
if (TotalCount == 0 && CloseAll)
{
CloseAll = false;
TradeStart = TimeCurrent()+CoolingTime*60;
}
Comment("PipsProfit = ",DoubleToStr(PipsProfit,1),"\nCloseAll = ",CloseAll,"\nTotalCount = ",TotalCount);
if (TotalCount == 0 && !CloseAll && TimeCurrent() > TradeStart)
{
int Tries;
int Tiket1=-1, Tiket2=-1, Tiket3=-1;
Tries = 0;
while(Tiket1 == -1)
{
Tiket1 = SendOrder(Pair1+Suffix,TradeType1);
if (Tiket1 == -1)
{
Показано первые 50% кода (символов: 2998)
Введите ваш email и нажмите кнопку, чтобы перейти к оплате.