Исходный код · ID 2802
goblin_bipolar_editiontunedprofitandatrhmav3.mq4
Вы автор или правообладатель?
Сообщите нам, если считаете, что материал размещён без разрешения.
Сообщить о материале
Обращение по товару «goblin_bipolar_editiontunedprofitandatrhmav3.mq4» отправится на рассмотрение. Укажите контакт для ответа и опишите причину.
Поиск по коду файла
extern string SystemWideParms = "** Goblin Systemwide Parameters **";
extern double LotSize = 0.1; // First order will be for this lot size
extern double LotsIncreaseBy = 2.0; //New orders will be the previous size times this amount
extern bool UseMoneyMgmt=false; // if true, the lots size will increase based on account size
extern double EquityProtectionLevel=0.0; // Min. equity to preserve in the event things go bad; all orders for Symbol/Magic will be closed.
extern double MaxLossPerOrder=0.0; // Max. loss tolerance per order; once reached, order will be closed.
extern int RiskPercent=0.75; // risk to calculate the lots size (only if mm is enabled)
extern bool UseFiboLotSizeProgression=false;
extern bool VolatilityBasedPipSpacing= false;
extern bool VolatilityBasedProfitTarget=false;
extern double ProfitTargetFactor = 0.80;
extern double ATRIncreaseDecreaseFactor= 1;
extern int ATR_Period = 20;
extern int ATR_Timeframe = 240;
int last_bar= 1;
extern string LongTradeParms = "** Goblin Buy Side Parameters **";
extern double LongTakeProfit = 10; // Profit Goal for the latest order opened
extern double LongInitialStop = 0; // StopLoss
extern double LongTrailingStop = 0; // Pips to trail the StopLoss
extern int LongMaxTrades=4; // Maximum number of orders to open
extern int LongPips=5; // Distance in Pips from one order to another
extern double LongSecureProfit=0; // If profit made is bigger than SecureProfit we close the orders
extern bool LongAccountProtection=false; // If one the account protection will be enabled, 0 is disabled
extern int LongOrderstoProtect=2; // This number subtracted from LongMaxTrades is the number of open orders to enable the account protection.
extern string ShortTradeParms = "** Goblin Sell Side Parameters **";
extern double ShortTakeProfit = 10; // Profit Goal for the latest order opened
extern double ShortInitialStop = 0; // StopLoss
extern double ShortTrailingStop = 0; // Pips to trail the StopLoss
extern int ShortMaxTrades=4; // Maximum number of orders to open
extern int ShortPips=5; // Distance in Pips from one order to another
extern double ShortSecureProfit=0; // If profit made is bigger than SecureProfit we close the orders
extern bool ShortAccountProtection=false; // If one the account protection will be enabled, 0 is disabled
extern int ShortOrderstoProtect=2; // This number subtracted from LongMaxTrades is the number of open orders to enable the account protection.
extern bool CloseOnEquityTarget = false;
extern bool AutoRestartAfterEqTarget = false;
extern double EquityTargetPercentage = 5.0;
extern bool CloseOnFloatPL = true;
extern double MaxFloatPL = 100.00; //Max floating profit/loss allowed when closing EA
extern double MinFloatPL = -100.00;
int LongMagicNumber = 0; // Magic number for the long orders placed
int L_OpenOrders=0;
int L_Count=0;
int L_Slippage=5;
double L_sl=0;
double L_tp=0;
double BuyPrice=0;
double L_OrderLotSize=0;
int L_Mode=0;
int L_OrderType=0;
bool L_ContinueOpening=true;
double L_LastPrice=0;
int L_PreviousOpenOrders=0;
double L_Profit=0;
int L_LastTicket=0;
int L_LastType=0;
double L_LastClosePrice=0;
double L_LastLots=0;
double L_PipValue=0;
double HL_sl=0;
double HL_tp=0;
double StartBalance, EquityTarget;
bool LastCloseOnEquityTarget = false;
int ShortMagicNumber = 0; // Magic number for the short orders placed
int S_OpenOrders=0;
int S_Count=0;
int S_Slippage=5;
double S_sl=0;
double S_tp=0;
double SellPrice=0;
double S_OrderLotSize=0;
int S_Mode=0;
int S_OrderType=0;
bool S_ContinueOpening=true;
double S_LastPrice=0;
int S_PreviousOpenOrders=0;
double S_Profit=0;
int S_LastTicket=0;
int S_LastType=0;
double S_LastClosePrice=0;
double S_LastLots=0;
double S_PipValue=0;
double HS_sl=0;
double HS_tp=0;
string text="", text2="";
double DnTrendVal=0,UpTrendVal=0,TrendVal=0;
string TrendTxt="analyzing...";
int trendtype=0;
bool AllowTrading=true;
double G_MinLotSize=0;
double G_MaxLotSize=0;
double G_LotStep=0;
double G_Decimals=0;
int G_AcctLeverage=0;
int G_CurrencyLotSize=0;
double G_OrderLotSize=0;
int G_Count=0;
int G_Slippage=5;
int G_TargetEquity=0;
int S_OrderTypeTmp=0,L_OrderTypeTmp=0;
bool ExitWithOpenOrdersBasedON=true;
int OpenOrdersBasedOn=1;
bool Halt = false;
double S_Lots=0,L_Lots=0;
double ShortHTakeProfit=0,LongHTakeProfit=0;
int HL_OpenOrders=0,HS_OpenOrders=0;
bool HL_ContinueOpening=true,HS_ContinueOpening=true;
extern double HedgeFactor = 2;
extern double HLsl=1000,HSsl=1000;
extern double HLtp=1000,HStp=1000;
extern int LongHedgeSpacing=1000;
extern int ShortHedgeSpacing=1000;
int init()
{
// код доступен только после оплаты
}
int start()
{
// код доступен только после оплаты
}
void CloseAllTrades()
{
int total = OrdersTotal();
for (int y=OrdersTotal()-1; y>=0; y--)
{
OrderSelect(y, SELECT_BY_POS, MODE_TRADES);
{
int type = OrderType();
bool result = false;
int TriesNum = 5;
int tries=0;
while (!result && tries < TriesNum)
{
RefreshRates();
switch(type)
{
case OP_BUY :
result = OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),L_Slippage,Pink);
break;
case OP_SELL:
result = OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),S_Slippage,Pink);
}
tries++;
}
if (!result) Print("Error closing order : ");
}
}
}
void ManageClose()
{
if (CloseOnEquityTarget && !LastCloseOnEquityTarget) {
StartBalance = AccountBalance();
}
LastCloseOnEquityTarget = CloseOnEquityTarget;
if (CloseOnFloatPL && (AccountProfit()>=MaxFloatPL || AccountProfit()<=MinFloatPL) )
{
CloseAllTrades();
Halt = true;
}
if (CloseOnEquityTarget && !Halt)
{
EquityTarget = StartBalance*(1.0 + EquityTargetPercentage/100.0);
if (AccountEquity()>=EquityTarget )
{
CloseAllTrades();
StartBalance = AccountBalance();
if (!AutoRestartAfterEqTarget) Halt = true;
}
}
if (!CloseOnFloatPL && !CloseOnEquityTarget)
{
if (Halt) StartBalance = AccountBalance();
Halt = false;
}
}
void LongGoblin()
{
if (MathAbs(MaxLossPerOrder) > 0)
{
for(L_Count=OrdersTotal();L_Count>=0;L_Count--)
{
RefreshRates();
OrderSelect(L_Count,SELECT_BY_POS,MODE_TRADES);
if (OrderSymbol() == Symbol())
{
if (OrderType() == OP_BUY && OrderMagicNumber() == LongMagicNumber && OrderProfit() <= MathAbs(MaxLossPerOrder) * (-1)) { OrderClose(OrderTicket(),OrderLots(),Bid,L_Slippage,White); }
if (OrderType() == OP_SELL && OrderMagicNumber() == LongMagicNumber && OrderProfit() <= MathAbs(MaxLossPerOrder) * (-1)) { OrderClose(OrderTicket(),OrderLots(),Ask,L_Slippage,White); }
}
}
}
L_Lots=0;
L_Profit=0;
L_OpenOrders=0;
for(L_Count=0;L_Count<OrdersTotal();L_Count++)
{
OrderSelect(L_Count, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol()==Symbol() && OrderMagicNumber() == LongMagicNumber /*&& OrderType() == OP_BUY*/)
{L_OpenOrders++;L_Profit=L_Profit+OrderProfit();L_Lots=L_Lots+OrderLots();}
}
HL_OpenOrders=0;
for(L_Count=0;L_Count<OrdersTotal();L_Count++)
{
OrderSelect(L_Count, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol()==Symbol() && OrderMagicNumber() == LongMagicNumber && OrderType() == OP_SELL)
{HL_OpenOrders++;/*L_Profit=L_Profit+OrderProfit();L_Lots=L_Lots+OrderLots();*/}
}
L_PipValue = MarketInfo(Symbol(),MODE_TICKVALUE);
if (L_PipValue==0) { L_PipValue=5; }
if (L_PreviousOpenOrders>L_OpenOrders)
{
for(L_Count=OrdersTotal();L_Count>=0;L_Count--)
{
OrderSelect(L_Count, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol()==Symbol() && OrderMagicNumber() == LongMagicNumber && OrderType() == OP_BUY)
{
int m_Ticket = OrderTicket();
OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),L_Slippage,Blue);
Print("Closing Buy Order ",m_Ticket);
return(0);
}
}
}
L_PreviousOpenOrders=L_OpenOrders;
if (L_OpenOrders>=LongMaxTrades)
{
L_ContinueOpening=False;
} else {
L_ContinueOpening=True;
}
if (HL_OpenOrders>0)
{
HL_ContinueOpening=false;
} else {
HL_ContinueOpening=True;
}
if (L_LastPrice==0)
{
for(L_Count=0;L_Count<OrdersTotal();L_Count++)
{
OrderSelect(L_Count, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol()==Symbol() && OrderMagicNumber() == LongMagicNumber && OrderType() == OP_BUY)
{
L_LastPrice=OrderOpenPrice();
L_OrderType=2;
}
}
}
if (L_OpenOrders<1) {L_OrderType=OpenOrdersBasedOnTrendRSX();}
if (ExitWithOpenOrdersBasedON && L_OrderTypeTmp==4)
{
L_PreviousOpenOrders=L_OpenOrders+1;
L_ContinueOpening=False;
texПоказано первые 50% кода (символов: 21827)
Что вы получите после оплаты
На этой странице откроется полный исходный код файла вместо ознакомительного фрагмента.
Зачем нужен email? Адрес передаётся вместе с заказом в магазин и сохраняется для связи заказа с оплатой. Укажите адрес, к которому у вас есть доступ.
Чтобы оформить заказ, введите email и перейдите к оплате.
Стоимость полного кода
2 183₽
≈ $25.65