//+------------------------------------------------------------------+
//| Scalp.mq4 |
//| Copyright 2020, |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, "
#property link "http://www.forexsystems.biz"
#property version "1.00"
#property strict
//--- Inputs
extern double Lots = 0.01; // торговый объем ордера
extern double MaxLot = 5; // максимальный торговый объем
extern double KLot = 1; // увеличение лота
extern int StopLoss = 0; // лось
extern int TakeProfit = 0; // язь
extern int CloseSig = 1; // 1-закрытие по сигналу 0-нет
extern int Shift = 5; // до какого бара сигнал
extern int Slip = 30; // реквот
extern int Magic = 123; // магик
extern string s = " ------------- Настройки BUY ------------- ";
extern string IndName = "ScalpM15_BUY";
extern string ss = " ------------- Настройки SELL ------------- ";
extern string IndName2 = "ScalpM15_SELL";
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
Comment("");
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int CountTrades()
{
int count=0;
for(int i=OrdersTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
{
if(OrderType()<2) count++;
}
}
}
return(count);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void PutOrder(int type,double price)
{
int r=0;
color clr=Green;
double sl=0,tp=0;
if(type==1 || type==3 || type==5)
{
clr=Red;
if(StopLoss>0)
sl=NormalizeDouble(price+StopLoss*_Point,_Digits);
if(TakeProfit>0)
tp=NormalizeDouble(price-TakeProfit*_Point,_Digits);
}
if(type==0 || type==2 || type==4)
{
clr=Blue;
if(StopLoss>0)
sl=NormalizeDouble(price-StopLoss*_Point,_Digits);
if(TakeProfit>0)
tp=NormalizeDouble(price+TakeProfit*_Point,_Digits);
}
r=OrderSend(NULL,type,Lot(),NormalizeDouble(price,_Digits),Slip,sl,tp,"",Magic,0,clr);
return;
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void CloseAll(int ot=-1)
{
bool cl;
for(int i=OrdersTotal()-1; i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
{
if(OrderType()==0 && (ot==0 || ot==-1))
{
RefreshRates();
cl=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,_Digits),Slip,White);
}
if(OrderType()==1 && (ot==1 || ot==-1))
{
RefreshRates();
cl=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,_Digits),Slip,White);
}
}
}
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double Lot()
{
double lot=Lots;
if(CountTrades()>0)
lot=NormalizeDouble(Lots*MathPow(KLot,CountTrades()),2);
if(lot>MaxLot)
lot=Lots;
return(lot);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
double up=iCustom(NULL,0,IndName,0,Shift);
double dn=iCustom(NULL,0,IndName2,1,Shift);
double sto=iCustom(NULL,0,IndName,1,Shift);
double sto1=iCustom(NULL,0,IndName2,0,Shift);
if(CountTrades()<1)
{
if(up!=EMPTY_VALUE) PutOrder(0,Ask);
if(dn!=EMPTY_VALUE) PutOrder(1,Bid);
}
if(CloseSig>0)
{
if(sto!=EMPTY_VALUE) CloseAll(0);
if(sto1!=EMPTY_VALUE) CloseAll(1);
}
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| AllProfit.mq4 |
//| Copyright 2019, AM2 |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, AM2"
#property link "http://www.forexsystems.biz"
#property version "1.00"
#property strict
//--- Inputs
extern double Lots = 0.01; // торговый объем ордера
extern double Pro = 1; // язь в рублях
extern int Slip = 30; // реквот
extern int Magic = 123; // магик
extern bool Buy = 1; // баи
extern bool Sell = 1; // сэлы
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
Comment("");
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void PutOrder(int type,double price)
{
int r=0;
color clr=Green;
if(type==1 || type==3 || type==5)
{
clr=Red;
}
if(type==0 || type==2 || type==4)
{
clr=Blue;
}
r=OrderSend(NULL,type,Lot(),NormalizeDouble(price,Digits),Slip,0,0,"",Magic,0,clr);
return;
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int CountTrades(int type=-1)
{
int count=0;
for(int i=OrdersTotal()-1; i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic && TimeDay(OrderOpenTime())==Day())
{
if(OrderType()== type || type==-1)
count++;
}
}
}
return(count);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double Lot()
{
double lot=Lots;
if(CountTrades()>0)
lot=NormalizeDouble(Lots*MathPow(2,CountTrades()),2);
if(lot>5)
lot=Lots;
return(lot);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int OldCountTrades(int type=-1)
{
int count=0;
for(int i=OrdersTotal()-1; i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic && TimeDay(OrderOpenTime())!=Day())
{
if(OrderType()== type || type==-1)
count++;
}
}
}
return(count);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void CloseAll(int ot=-1)
{
bool cl;
for(int i=OrdersTotal()-1; i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic && TimeDay(OrderOpenTime())==Day())
{
if(OrderType()==0 && (ot==0 || ot==-1))
{
RefreshRates();
cl=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,Digits),Slip,White);
}
if(OrderType()==1 && (ot==1 || ot==-1))
{
RefreshRates();
cl=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,Digits),Slip,White);
}
}
}
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void OldCloseAll(int ot=-1)
{
bool cl;
for(int i=OrdersTotal()-1; i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic && TimeDay(OrderOpenTime())!=Day())
{
if(OrderType()==0 && (ot==0 || ot==-1))
{
RefreshRates();
cl=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,Digits),Slip,White);
}
if(OrderType()==1 && (ot==1 || ot==-1))
{
RefreshRates();
cl=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,Digits),Slip,White);
}
}
}
}
}
//+------------------------------------------------------------------+
//| Профит всех ордеров по типу ордера |
//+------------------------------------------------------------------+
double AllProfit(int type=-1)
{
double pr=0;
for(int i=OrdersTotal()-1; i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic && TimeDay(OrderOpenTime())==Day())
{
if(OrderType()==type || type==-1)
{
pr+=OrderProfit()+OrderCommission()+OrderSwap();
}
}
}
}
return(pr);
}
//+------------------------------------------------------------------+
//| Профит всех ордеров по типу ордера |
//+------------------------------------------------------------------+
double OldAllProfit(int type=-1)
{
double pr=0;
for(int i=OrdersTotal()-1; i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic && TimeDay(OrderOpenTime())!=Day())
{
if(OrderType()==type || type==-1)
{
pr+=OrderProfit()+OrderCommission()+OrderSwap();
}
}
}
}
return(pr);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
double op=iOpen(NULL,PERIOD_D1,0);
if(AllProfit()>Pro && Pro>0) CloseAll();
if(OldAllProfit(0)>Pro && Pro>0)
{
OldCloseAll(0);
}
if(OldAllProfit(1)>Pro && Pro>0)
{
OldCloseAll(1);
}
if(CountTrades(0)<1 && Ask>op && Buy)
{
PutOrder(0,Ask);
PutOrder(1,Bid);
}
if(CountTrades(1)<1 && Bid<op && Sell)
{
PutOrder(0,Ask);
PutOrder(1,Bid);
}
Comment("\n Lot: ",Lots,
"\n Trades: ",CountTrades(),
"\n Buy Trades: ",OldCountTrades(0),
"\n Sell Trades: ",OldCountTrades(1),
"\n Buy Profit: ",AllProfit(0),
"\n Sell Profit: ",AllProfit(1),
"\n Old Buy Profit: ",OldAllProfit(0),
"\n Old Sell Profit: ",OldAllProfit(1));
}
//+------------------------------------------------------------------+
//+----------------------------------------------------------------------------+
//| HMA.mq4 |
//| Copyright © 2006 WizardSerg <wizardserg@mail.ru>, ForexMagazine #104 |
//| wizardserg@mail.ru |
//| Revised by IgorAD,igorad2003@yahoo.co.uk |
//| Personalized by iGoR AKA FXiGoR for the Trend Slope Trading method (T_S_T) |
//| Link: |
//| contact: thefuturemaster@hotmail.com |
//+----------------------------------------------------------------------------+
#property copyright "И maloma руку приложил <img src='http://opentraders.ru/templates/skin/g6h/images/smilies/002.gif' alt=' :) '> "
//#property copyright "MT4 release WizardSerg <wizardserg@mail.ru>,ForexMagazine #104"
//#property link "wizardserg@mail.ru"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
//---- input parameters
extern int period=5;//15;
extern ENUM_TIMEFRAMES TimeFrame = PERIOD_CURRENT;
int method=2;//3; // MODE_SMA
int price=5;//0; // PRICE_CLOSE
int y=0;
//---- buffers
double Uptrend[];
double Dntrend[];
double ExtMapBuffer[];
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(3);
SetIndexBuffer(0, Uptrend);
//ArraySetAsSeries(Uptrend, true);
SetIndexBuffer(1, Dntrend);
//ArraySetAsSeries(Dntrend, true);
SetIndexBuffer(2, ExtMapBuffer);
ArraySetAsSeries(ExtMapBuffer, true);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);
IndicatorShortName("Signal Line("+period+")");
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double WMA(int x, int p)
{
return(iMA(NULL, TimeFrame, p, 0, method, price, x));
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
if (Period()>1440) return(0);
int counted_bars=IndicatorCounted();
if(counted_bars < 0)
return(-1);
int x=0;
int p=MathSqrt(period);
int e=iBars(Symbol(),TimeFrame) - counted_bars + period + 1;
//----
double vect[], trend[];
//----
if(e > iBars(Symbol(),TimeFrame))
e=iBars(Symbol(),TimeFrame);
//----
ArrayResize(vect, e);
ArraySetAsSeries(vect, true);
ArrayResize(trend, e);
ArraySetAsSeries(trend, true);
//----
if (Period()==1) for(x=0; x < e; x++) for(y=x*1440;y<=x*1440+1439;y++) vect[y]=2*WMA(x, period/2) - WMA(x, period);
if (Period()==5) for(x=0; x < e; x++) for(y=x*288;y<=x*288+287;y++) vect[y]=2*WMA(x, period/2) - WMA(x, period);
if (Period()==15) for(x=0; x < e; x++) for(y=x*96;y<=x*96+95;y++) vect[y]=2*WMA(x, period/2) - WMA(x, period);
if (Period()==30) for(x=0; x < e; x++) for(y=x*48;y<=x*48+47;y++) vect[y]=2*WMA(x, period/2) - WMA(x, period);
if (Period()==60) for(x=0; x < e; x++) for(y=x*24;y<=x*24+23;y++) vect[y]=2*WMA(x, period/2) - WMA(x, period);
if (Period()==240) for(x=0; x < e; x++) for(y=x*6;y<=x*6+5;y++) vect[y]=2*WMA(x, period/2) - WMA(x, period);
if (Period()==1440) for(x=0; x < e; x++) for(y=x;y<=x;y++) vect[y]=2*WMA(x, period/2) - WMA(x, period);
//----
for(x=0; x < e-period; x++)
ExtMapBuffer[x]=iMAOnArray(vect, 0, p, 0, method, x);
for(x=e-period; x>=0; x--)
{
trend[x]=trend[x+1];
if (ExtMapBuffer[x]> ExtMapBuffer[x+1]) trend[x] =1;
if (ExtMapBuffer[x]< ExtMapBuffer[x+1]) trend[x] =-1;
if (trend[x]>0)
{ Uptrend[x]=ExtMapBuffer[x];
if (trend[x+1]<0) Uptrend[x+1]=ExtMapBuffer[x+1];
Dntrend[x]=EMPTY_VALUE;
}
else
if (trend[x]<0)
{
Dntrend[x]=ExtMapBuffer[x];
if (trend[x+1]>0) Dntrend[x+1]=ExtMapBuffer[x+1];
Uptrend[x]=EMPTY_VALUE;
}
//Print( " trend=",trend[x]);
}
return(0);
}
//+------------------------------------------------------------------+
<code>//+------------------------------------------------------------------+ //| PriceBorder.mq4 | //| Copyright 2020, | //| http://www.forexsystems.biz | //+------------------------------------------------------------------+ #property copyright "Copyright 2020, " #property link "http://www.forexsystems.biz" #property version "1.00" #property strict #property indicator_chart_window extern int MA=5; extern string IndName = "©Price Border (1)"; extern string TimeFrame = "All tf"; extern int HalfLength = 61; extern int Price = 0; extern double ATRMultiplier = 2.6; extern int ATRPeriod = 110; extern bool Interpolate = TRUE; bool b=1,s=1; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--- double ma = NormalizeDouble(iMA(NULL,0,MA,0,0,0,0),_Digits); double up=iCustom(NULL,0,IndName,TimeFrame,HalfLength,Price,ATRMultiplier,ATRPeriod,Interpolate,1,0); double dn=iCustom(NULL,0,IndName,TimeFrame,HalfLength,Price,ATRMultiplier,ATRPeriod,Interpolate,2,0); if(Ask<ma && up<ma && Ask<dn && b) { Alert(_Symbol+" BUY!"); b=0; s=1; } if(Bid>ma && dn>ma && Bid>up && s) { Alert(_Symbol+" SELL!"); s=0; b=1; } Comment("\n UP: ",up, "\n DN: ",dn, "\n MA: ",ma, "\n BID: ",Bid); //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+ </code>
Во-вторых: если не найдете, через 9 посещений сайта сможете сами заказать
Slava78