#property version "1.00"
#property strict
extern bool Use_TP_In_Money=false;
extern double TP_In_Money=10;
extern bool Use_TP_In_percent=false;
extern double TP_In_Percent=10;
extern bool tick=true;//every tick\open price
extern int BarsToCount=10;
extern bool Exit=false;//Enable Exit strategy
extern double IncreaseFactor=0.001; //IncreaseFactor
extern int CandlesToRetrace=10; //Num.Of Candles For Divergence
extern double Lots=0.01; //Lots size
extern double TrailingStop=40; //TrailingStop
extern double Stop_Loss=20; //Stop Loss
extern int MagicNumber=1234; //MagicNumber
input double Take_Profit=50; //TakeProfit
extern int FastMA=6; //FastMA
extern int SlowMA=85; //SlowMA
extern double Mom_Sell=0.3; //Momentum_Sell
extern double Mom_Buy=0.3; //Momentum_Buy
input bool UseEquityStop = true; //Use Equity Stop
input double TotalEquityRisk = 1.0; //Total Equity Risk
input int Max_Trades=10;
extern bool USETRAILINGSTOP=true; //IF USE TRAILING STOP
extern int WHENTOTRAIL=40;//WHEN TO TRAIL
extern int TRAILAMOUNT=40;//TRAIL AMOUNT
extern int Distance_From_Candle=3;//Distance From Candle
extern bool USECANDELTRAIL=true;//USE CANDEL TRAIL
extern int X=3;//NUMBER OF CANDLES
extern bool USEMOVETOBREAKEVEN=true;//Enable "no loss"
extern double WHENTOMOVETOBE=30; //When to move break even
extern double PIPSTOMOVESL=30; //How much pips to move sl
int buyticket;
int selticket;
int BUYSTOPCANDLE;
int SELSTOPCANDLE;
int err;
int total=0;
double
Lot,Dmax,Dmin,// Amount of lots in a selected order
Lts, // Amount of lots in an opened order
Min_Lot, // Minimal amount of lots
Step, // Step of lot size change
Free, // Current free margin
One_Lot, // Price of one lot
Price, // Price of a selected order,
pips,
MA_1,MA_2,MACD_SIGNAL;
int Type,freeze_level,Spread;
double priceopen,stoploss,takeprofit;
int orderticket;
int
Period_MA_2, Period_MA_3, // Calculation periods of MA for other timefr.
Period_MA_02, Period_MA_03, // Calculation periods of supp. MAs
K2,K3,T,L;
double AccountEquityHighAmt,PrevEquity;
int OnInit()
{
// код доступен только после оплаты
}
void OnDeinit(const int reason)
{
}
void OnTick(void)
{
// код доступен только после оплаты
}
void adjustTrail()// CANDLE TRAIL
{
static datetime dtBarCurrent=WRONG_VALUE;
datetime dtBarPrevious=dtBarCurrent;
dtBarCurrent=(datetime) SeriesInfoInteger(_Symbol,_Period,SERIES_LASTBAR_DATE);
bool NewBarFlag=(dtBarCurrent!=dtBarPrevious);
BUYSTOPCANDLE=iLowest(Symbol(),0,1,X,0);//Lowest
SELSTOPCANDLE=iHighest(Symbol(),0,2,X,0);//Highest
for(int b=OrdersTotal()-1; b>=0; b--)
{
if(OrderSelect(b,SELECT_BY_POS,MODE_TRADES))
if(OrderMagicNumber()!=MagicNumber)
continue;
if(OrderSymbol()==Symbol())//Symbol
if(OrderType()==OP_BUY)//OrderType
if(USECANDELTRAIL)
{
if(NewBarFlag)
{
RefreshRates();
stoploss=Low[BUYSTOPCANDLE]-Distance_From_Candle*pips;
takeprofit=OrderTakeProfit()+pips*TRAILAMOUNT;
double StopLevel=MarketInfo(Symbol(),MODE_STOPLEVEL)+MarketInfo(Symbol(),MODE_SPREAD);
if(stoploss<StopLevel*pips)
stoploss=StopLevel*pips;
string symbol=OrderSymbol();
double point=SymbolInfoDouble(symbol,SYMBOL_POINT);
if(MathAbs(OrderStopLoss()-stoploss)>point)
if((pips*TRAILAMOUNT)>(int)SymbolInfoInteger(_Symbol,SYMBOL_TRADE_FREEZE_LEVEL)*pips)
if(CheckStopLoss_Takeprofit(OP_BUY,stoploss,takeprofit))
if(OrderModifyCheck(OrderTicket(),OrderOpenPrice(),stoploss,takeprofit))
if(OrderStopLoss()<Low[BUYSTOPCANDLE]-Distance_From_Candle*pips)
if(!OrderModify(OrderTicket(),OrderOpenPrice(),Low[BUYSTOPCANDLE]-Distance_From_Candle*pips,takeprofit,0,CLR_NONE))
Print("eror");
}
}
else
if(Bid-OrderOpenPrice()>WHENTOTRAIL*pips)
if(OrderStopLoss()<Bid-pips*TRAILAMOUNT)
if(!OrderModify(OrderTicket(),OrderOpenPrice(),Bid-(pips*TRAILAMOUNT),OrderTakeProfit(),0,CLR_NONE))//ԿԿԿԿԿ ԿԿ STOPLOS
Print("eror");
}
for(int s=OrdersTotal()-1; s>=0; s--)
{
if(OrderSelect(s,SELECT_BY_POS,MODE_TRADES))
if(OrderMagicNumber()!=MagicNumber)
continue;
if(OrderSymbol()==Symbol())
if(OrderType()==OP_SELL)
if(USECANDELTRAIL)
{
if(NewBarFlag)
{
RefreshRates();
stoploss=High[SELSTOPCANDLE]+Distance_From_Candle*pips;
takeprofit=OrderTakeProfit()-pips*TRAILAMOUNT;
double StopLevel=MarketInfo(Symbol(),MODE_STOPLEVEL)+MarketInfo(Symbol(),MODE_SPREAD);
if(stoploss<StopLevel*pips)
stoploss=StopLevel*pips;
if(takeprofit<StopLevel*pips)
takeprofit=StopLevel*pips;
string symbol=OrderSymbol();
double point=SymbolInfoDouble(symbol,SYMBOL_POINT);
if(MathAbs(OrderStopLoss()-stoploss)>point)
if((pips*TRAILAMOUNT)>(int)SymbolInfoInteger(_Symbol,SYMBOL_TRADE_FREEZE_LEVEL)*pips)
if(CheckStopLoss_Takeprofit(OP_SELL,stoploss,takeprofit))
if(OrderModifyCheck(OrderTicket(),OrderOpenPrice(),stoploss,takeprofit))
if(OrderStopLoss()>High[SELSTOPCANDLE]+Distance_From_Candle*pips)
if(!OrderModify(OrderTicket(),OrderOpenPrice(),High[SELSTOPCANDLE]+Distance_From_Candle*pips,takeprofit,0,CLR_NONE))
Print("eror");
}
}
else
if(OrderOpenPrice()-Ask>WHENTOTRAIL*pips)
if(OrderStopLoss()>Ask+pips*TRAILAMOUNT || OrderStopLoss()==0)
if(!OrderModify(OrderTicket(),OrderOpenPrice(),Ask+(pips*TRAILAMOUNT),OrderTakeProfit(),0,CLR_NONE))
Print("eror");
}
}
void MOVETOBREAKEVEN()
{
for(int b=OrdersTotal()-1; b>=0; b--)
{
if(OrderSelect(b,SELECT_BY_POS,MODE_TRADES))
if(OrderMagicNumber()!=MagicNumber)
continue;
if(OrderSymbol()==Symbol())
if(OrderType()==OP_BUY)
if(Bid-OrderOpenPrice()>WHENTOMOVETOBE*pips)
if(OrderOpenPrice()>OrderStopLoss())
if(CheckStopLoss_Takeprofit(OP_BUY,OrderOpenPrice()+(PIPSTOMOVESL*pips),OrderTakeProfit()))
if(OrderModifyCheck(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+(PIPSTOMOVESL*pips),OrderTakeProfit()))
if(!OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+(PIPSTOMOVESL*pips),OrderTakeProfit(),0,CLR_NONE)Показано первые 50% кода (символов: 19268)
Введите ваш email и нажмите кнопку, чтобы перейти к оплате.