if(AccountBalance()<PBalance && AccountBalance()>MBalance && OrdersTotal()<1)
//+------------------------------------------------------------------+
//| ParserCME.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
input string URL="https://www.cmegroup.com/";
input string SubString="cmeTableRight";// data-ce-key="19452"
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
string cookie=NULL,headers;
char post[],result[];
//--- для работы с сервером необходимо добавить URL "https://www.cmegroup.com/"
//--- в список разрешенных URL (Главное меню->Сервис->Настройки, вкладка "Советники"):
//--- обнуляем код последней ошибки
ResetLastError();
//--- загрузка html-страницы
int res=WebRequest("GET",URL,cookie,NULL,500,post,0,result,headers);
if(res==-1)
{
Print("Ошибка в WebRequest. Код ошибки =",GetLastError());
//--- возможно, URL отсутствует в списке, выводим сообщение о необходимости его добавления
MessageBox("Необходимо добавить адрес '"+URL+"' в список разрешенных URL во вкладке 'Советники'","Ошибка",MB_ICONINFORMATION);
}
string s=CharArrayToString(result,0,ArraySize(result));
int sf=StringFind(s,SubString);
string num=StringSubstr(s,sf+20,5);
Comment("\n Num: ",num,
"\n",
"\n",s);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
Прошу Вас написать дополнение к советнику а именно при включении советника на рабочем столе отображающийся индикаторы используемые советником
www.opentraders.ru/downloads/2488/
чтобы каждый раз после перезагрузке компа снова не настраивать рабочий стол
extern string TemplateName = "3MA.tpl";
ChartApplyTemplate(0,TemplateName);
//+------------------------------------------------------------------+
//| 3MA3.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.1; // лот
extern double KLot = 1; // умножение лота
extern double MaxLot = 5; // максимальный лот
extern int StopLoss = 333;
extern int TakeProfit = 444;
extern int TrailingStop = 0;
extern int Shift = 2;
extern int Slip = 30;
extern int Magic = 123;
extern bool MA3Filter = 0;
extern int MA1Period = 10;
extern int MA1Shift = 0;
extern int MA1Method = 1;
extern int MA1Price = 0;
extern int MA2Period = 45;
extern int MA2Shift = 0;
extern int MA2Method = 1;
extern int MA2Price = 0;
extern int MA3Period = 200;
extern int MA3Shift = 0;
extern int MA3Method = 1;
extern int MA3Price = 0;
extern string TemplateName = "3MA.tpl";
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
ChartApplyTemplate(0,TemplateName);
Comment("");
//---
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,Lots,NormalizeDouble(price,_Digits),Slip,sl,tp,"",Magic,0,clr);
return;
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double Lot()
{
double lot=Lots;
for(int i=OrdersHistoryTotal()-1; i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
{
if(OrderProfit()>0)
break;
if(OrderProfit()<0)
{
lot=OrderLots()*KLot;
break;
}
}
}
}
if(lot>MaxLot)
lot=Lots;
return(lot);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void Trailing()
{
bool mod;
for(int i=OrdersTotal()-1; i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
{
if(OrderType()==OP_BUY)
{
if(Bid-OrderOpenPrice()>TrailingStop*_Point)
{
if(OrderStopLoss()<Bid-TrailingStop*_Point)
{
mod=OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TrailingStop*_Point,OrderTakeProfit(),0,Yellow);
return;
}
}
}
if(OrderType()==OP_SELL)
{
if((OrderOpenPrice()-Ask)>TrailingStop*_Point)
{
if((OrderStopLoss()>(Ask+TrailingStop*_Point)) || (OrderStopLoss()==0))
{
mod=OrderModify(OrderTicket(),OrderOpenPrice(),Ask+TrailingStop*_Point,OrderTakeProfit(),0,Yellow);
return;
}
}
}
}
}
}
}
//+------------------------------------------------------------------+
//| Check for open order conditions |
//+------------------------------------------------------------------+
void OpenPos()
{
double MA1=iMA(NULL,0,MA1Period,MA1Shift,MA1Method,MA1Price,Shift);
double MA2=iMA(NULL,0,MA2Period,MA2Shift,MA2Method,MA2Price,Shift);
double MA3=iMA(NULL,0,MA3Period,MA3Shift,MA3Method,MA3Price,Shift);
double MA12=iMA(NULL,0,MA1Period,MA1Shift,MA1Method,MA1Price,Shift+1);
double MA22=iMA(NULL,0,MA2Period,MA2Shift,MA2Method,MA2Price,Shift+1);
double MA32=iMA(NULL,0,MA3Period,MA3Shift,MA3Method,MA3Price,Shift+1);
bool buy = MA1>MA2 && MA12<MA22;
bool sell = MA1<MA2 && MA12>MA22;
if(MA3Filter)
{
buy = Bid>MA3 && MA1>MA2 && MA12<MA22;
sell = Bid<MA3 && MA1<MA2 && MA12>MA22;
}
if(buy)
PutOrder(0,Ask);
if(sell)
PutOrder(1,Bid);
}
//+------------------------------------------------------------------+
//| OnTick function |
//+------------------------------------------------------------------+
void OnTick()
{
if(TrailingStop>0)
Trailing();
if(CountTrades()<1)
OpenPos();
}
//+------------------------------------------------------------------+
AM2