新人对MQL4和MQL5的任何问题,对算法和代码的帮助和讨论 - 页 60 1...535455565758596061626364656667...1953 新评论 Anarchist 2017.01.08 17:29 #591 Sergey Gritsay: 在订单关闭块中有一个小故障,已修复。 非常感谢你,我现在就去查。 [删除] 2017.01.08 17:55 #592 你能告诉我为什么订单无法打开。它给出了一个错误130input double RSIperiod=14;input double Urov_70=70;input double Urov_30=30;input double Lot=0.01;input int TakeProfit=100;input int StopLoss=100;input int MagicNumber=523;input int slippage=30;double tp=0,sl=0,OrderBuy=0,OrderSell=0;int tiket;//+------------------------------------------------------------------+//| Expert initialization function |//+------------------------------------------------------------------+int OnInit() {//--- tp=NormalizeDouble(TakeProfit*_Point,_Digits); sl=NormalizeDouble(StopLoss*_Point,_Digits); return(INIT_SUCCEEDED);//--- return(INIT_SUCCEEDED); }//+------------------------------------------------------------------+//| Expert deinitialization function |//+------------------------------------------------------------------+void OnDeinit(const int reason) { }//+------------------------------------------------------------------+//| Expert tick function |//+------------------------------------------------------------------+void OnTick() { for(int i=0; i<OrdersTotal(); i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderSymbol()==_Symbol && OrderMagicNumber()==MagicNumber) { if(OrderType()==OP_BUY){} if(OrderType()==OP_SELL){} } } double rsi=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,0); double rsi1=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,1);//+------------------------------------------------------------------+ if(OrderBuy<1 && rsi>Urov_70 && rsi1<Urov_70) { tiket= OrderSend(_Symbol,OP_BUY,Lot,Ask,slippage,sl,tp,NULL,MagicNumber,0,clrBlue); } if(OrderSell<1 && rsi<Urov_30 && rsi1>Urov_30) { tiket=OrderSend(_Symbol,OP_SELL,Lot,Bid,slippage,sl,tp,NULL,MagicNumber,0,clrRed); } }//+------------------------------------------------------------------+ Any questions from newcomers 初学者的问题 MQL4 MT4 MetaTrader PROBLEM RichLux 2017.01.08 18:04 #593 我不是专家--我可能是错的!这些线tp=NormalizeDouble(TakeProfit*_Point,_Digits)。sl=NormalizeDouble(StopLoss*_Point,_Digits)。如果你像这样去做,你会更好地理解它tp=NormalizeDouble(Ask+ TakeProfit*_Point,_Digits)。sl=NormalizeDouble(Bid- StopLoss*_Point,_Digits)。另外,你不需要将全局变量 tp和sl归零。 Artyom Trishkin 2017.01.08 18:04 #594 Ibragim Dzhanaev:你能告诉我为什么订单无法打开。错误130...错误130是一个接近的停止。检查它们的最小停止设置距离 - StopLevel而且,是的,上面已经指出--你的计算方法是不正确的。 [删除] 2017.01.08 18:15 #595 我这么做了--没有任何变化(是的,刚刚宣布。input double RSIperiod=14;input double Urov_70=70;input double Urov_30=30;input double Lot=0.01;input int TakeProfit=100;input int StopLoss=100;input int MagicNumber=523;input int slippage=30;double tp=0,sl=0,OrderBuy=0,OrderSell=0;int tiket;//+------------------------------------------------------------------+//| Expert initialization function |//+------------------------------------------------------------------+int OnInit() { tp=NormalizeDouble(Ask+TakeProfit*_Point,_Digits); sl=NormalizeDouble(Bid-StopLoss*_Point,_Digits); return(INIT_SUCCEEDED); }//+------------------------------------------------------------------+//| Expert deinitialization function |//+------------------------------------------------------------------+void OnDeinit(const int reason) { }//+------------------------------------------------------------------+//| Expert tick function |//+------------------------------------------------------------------+void OnTick() { for(int i=0; i<OrdersTotal(); i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderSymbol()==_Symbol && OrderMagicNumber()==MagicNumber) { if(OrderType()==OP_BUY){} if(OrderType()==OP_SELL){} } } double rsi=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,0); double rsi1=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,1);//+------------------------------------------------------------------+ double StopLossLevel; double TakeProfitLevel; if(StopLoss>0) StopLossLevel=Bid-StopLoss*Point; else StopLossLevel=0.0; if(TakeProfit>0) TakeProfitLevel=Ask+TakeProfit*Point; else TakeProfitLevel=0.0;///--- if(OrderBuy<1 && rsi>Urov_70 && rsi1<Urov_70) { tiket=OrderSend(_Symbol,OP_BUY,Lot,Ask,slippage,sl,tp,NULL,MagicNumber,0,clrBlue); } if(OrderSell<1 && rsi<Urov_30 && rsi1>Urov_30) { tiket=OrderSend(_Symbol,OP_SELL,Lot,Bid,slippage,sl,tp,NULL,MagicNumber,0,clrRed); } }//+------------------------------------------------------------------+ Any questions from newcomers 初学者的问题 MQL4 MT4 MetaTrader PROBLEM Sergey Gritsay 2017.01.08 18:19 #596 Ibragim Dzhanaev:我这么做了--没有任何变化(input double RSIperiod=14;input double Urov_70=70;input double Urov_30=30;input double Lot=0.01;input int TakeProfit=100;input int StopLoss=100;input int MagicNumber=523;input int slippage=30;double tp=0,sl=0,OrderBuy=0,OrderSell=0;int tiket;//+------------------------------------------------------------------+//| Expert initialization function |//+------------------------------------------------------------------+int OnInit() { tp=NormalizeDouble(Ask+TakeProfit*_Point,_Digits); sl=NormalizeDouble(Bid-StopLoss*_Point,_Digits); return(INIT_SUCCEEDED); }//+------------------------------------------------------------------+//| Expert deinitialization function |//+------------------------------------------------------------------+void OnDeinit(const int reason) { }//+------------------------------------------------------------------+//| Expert tick function |//+------------------------------------------------------------------+void OnTick() { for(int i=0; i<OrdersTotal(); i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderSymbol()==_Symbol && OrderMagicNumber()==MagicNumber) { if(OrderType()==OP_BUY){} if(OrderType()==OP_SELL){} } } double rsi=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,0); double rsi1=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,1);//+------------------------------------------------------------------+ double StopLossLevel; double TakeProfitLevel; if(StopLoss>0) StopLossLevel=Bid-StopLoss*Point; else StopLossLevel=0.0; if(TakeProfit>0) TakeProfitLevel=Ask+TakeProfit*Point; else TakeProfitLevel=0.0;///--- if(OrderBuy<1 && rsi>Urov_70 && rsi1<Urov_70) { tiket=OrderSend(_Symbol,OP_BUY,Lot,Ask,slippage,sl,tp,NULL,MagicNumber,0,clrBlue); } if(OrderSell<1 && rsi<Urov_30 && rsi1>Urov_30) { tiket=OrderSend(_Symbol,OP_SELL,Lot,Bid,slippage,sl,tp,NULL,MagicNumber,0,clrRed); } }//+------------------------------------------------------------------+将止损点的计算移到本体上。 tp=NormalizeDouble(Ask+TakeProfit*_Point,_Digits); sl=NormalizeDouble(Bid-StopLoss*_Point,_Digits);.. RichLux 2017.01.08 18:19 #597 tp=NormalizeDouble(Ask+TakeProfit*_Point,_Digits); sl=NormalizeDouble(Bid-StopLoss*_Point,_Digits)。这是OP_BUY的变体。为OP_SELLtp=NormalizeDouble(Bid-TakeProfit*_Point,_Digits)。sl=NormalizeDouble(Ask+StopLoss*_Point,_Digits)。 [删除] 2017.01.08 18:32 #598 错误148。每一次打勾,它都会打开。input double RSIperiod=14;input double Urov_70=70;input double Urov_30=30;input double Lot=0.01;input int TakeProfit=100;input int StopLoss=100;input int MagicNumber=523;input int slippage=30;double tp,sl,OrderBuy=0,OrderSell=0;int tiket;//+------------------------------------------------------------------+//| Expert initialization function |//+------------------------------------------------------------------+int OnInit() { return(INIT_SUCCEEDED); }//+------------------------------------------------------------------+//| Expert deinitialization function |//+------------------------------------------------------------------+void OnDeinit(const int reason) { }//+------------------------------------------------------------------+//| Expert tick function |//+------------------------------------------------------------------+void OnTick() { for(int i=0; i<OrdersTotal(); i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderSymbol()==_Symbol && OrderMagicNumber()==MagicNumber) { if(OrderType()==OP_BUY){} if(OrderType()==OP_SELL){} } } double rsi=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,0); double rsi1=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,1);//+------------------------------------------------------------------+ double StopLossLevel; double TakeProfitLevel; if(StopLoss>0) StopLossLevel=Bid-StopLoss*Point; else StopLossLevel=0.0; if(TakeProfit>0) TakeProfitLevel=Ask+TakeProfit*Point; else TakeProfitLevel=0.0; tp=NormalizeDouble(Ask+TakeProfit*_Point,_Digits); sl=NormalizeDouble(Bid-StopLoss*_Point,_Digits); tp=NormalizeDouble(Bid-TakeProfit*_Point,_Digits); sl=NormalizeDouble(Ask+StopLoss*_Point,_Digits);///--- if(OrderBuy<1 && rsi>Urov_70 && rsi1<Urov_70) { tiket=OrderSend(_Symbol,OP_BUY,Lot,Ask,slippage,sl,tp,NULL,MagicNumber,0,clrBlue); } if(OrderSell<1 && rsi<Urov_30 && rsi1>Urov_30) { tiket=OrderSend(_Symbol,OP_SELL,Lot,Bid,slippage,sl,tp,NULL,MagicNumber,0,clrRed); } }//+------------------------------------------------------------------+ Any questions from newcomers 初学者的问题 MQL4 MT4 MetaTrader Resetting variable value after RichLux 2017.01.08 18:56 #599 两个不同的sl tp值以不同的方式称呼它们:slSell , slBuy, tpSell, tpBuy [删除] 2017.01.08 19:05 #600 RichLux:两个不同的sl tp值以不同的方式称呼它们:slSell , slBuy, tpSell, tpBuy没有帮助(double tp,sl,OrderBuy=0,OrderSell=0;double slSell,slBuy,tpSell,tpBuy; int tiket;//+------------------------------------------------------------------+//| Expert initialization function |//+------------------------------------------------------------------+int OnInit() { return(INIT_SUCCEEDED); }//+------------------------------------------------------------------+//| Expert deinitialization function |//+------------------------------------------------------------------+void OnDeinit(const int reason) { }//+------------------------------------------------------------------+//| Expert tick function |//+------------------------------------------------------------------+void OnTick() { for(int i=0; i<OrdersTotal(); i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderSymbol()==_Symbol && OrderMagicNumber()==MagicNumber) { if(OrderType()==OP_BUY){} if(OrderType()==OP_SELL){} } } double rsi=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,0); double rsi1=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,1);//+------------------------------------------------------------------+ double StopLossLevel; double TakeProfitLevel; if(StopLoss>0) StopLossLevel=Bid-StopLoss*Point; else StopLossLevel=0.0; if(TakeProfit>0) TakeProfitLevel=Ask+TakeProfit*Point; else TakeProfitLevel=0.0; tpBuy=NormalizeDouble(Ask+TakeProfit*_Point,_Digits); slBuy=NormalizeDouble(Bid-StopLoss*_Point,_Digits); tpSell=NormalizeDouble(Bid-TakeProfit*_Point,_Digits); slSell=NormalizeDouble(Ask+StopLoss*_Point,_Digits);///--- if(OrderBuy<1 && rsi>Urov_70 && rsi1<Urov_70) { tiket=OrderSend(_Symbol,OP_BUY,Lot,Ask,slippage,sl,tp,NULL,MagicNumber,0,clrBlue); } if(OrderSell<1 && rsi<Urov_30 && rsi1>Urov_30) { tiket=OrderSend(_Symbol,OP_SELL,Lot,Bid,slippage,sl,tp,NULL,MagicNumber,0,clrRed); } }//+------------------------------------------------------------------+ Any questions from newcomers 初学者的问题 MQL4 MT4 MetaTrader [存档!]任何菜鸟问题,为了不给论坛添乱。专业人士,不要与它擦肩而过。没有你,哪里都不能去 - 2. 1...535455565758596061626364656667...1953 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
在订单关闭块中有一个小故障,已修复。
你能告诉我为什么订单无法打开。它给出了一个错误130
input double Urov_70=70;
input double Urov_30=30;
input double Lot=0.01;
input int TakeProfit=100;
input int StopLoss=100;
input int MagicNumber=523;
input int slippage=30;
double tp=0,sl=0,OrderBuy=0,OrderSell=0;
int tiket;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
tp=NormalizeDouble(TakeProfit*_Point,_Digits);
sl=NormalizeDouble(StopLoss*_Point,_Digits);
return(INIT_SUCCEEDED);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
for(int i=0; i<OrdersTotal(); i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
if(OrderSymbol()==_Symbol && OrderMagicNumber()==MagicNumber)
{
if(OrderType()==OP_BUY){}
if(OrderType()==OP_SELL){}
}
}
double rsi=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,0);
double rsi1=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,1);
//+------------------------------------------------------------------+
if(OrderBuy<1 && rsi>Urov_70 && rsi1<Urov_70)
{
tiket= OrderSend(_Symbol,OP_BUY,Lot,Ask,slippage,sl,tp,NULL,MagicNumber,0,clrBlue);
}
if(OrderSell<1 && rsi<Urov_30 && rsi1>Urov_30)
{
tiket=OrderSend(_Symbol,OP_SELL,Lot,Bid,slippage,sl,tp,NULL,MagicNumber,0,clrRed);
}
}
//+------------------------------------------------------------------+
我不是专家--我可能是错的!
这些线
tp=NormalizeDouble(TakeProfit*_Point,_Digits)。sl=NormalizeDouble(StopLoss*_Point,_Digits)。
如果你像这样去做,你会更好地理解它
tp=NormalizeDouble(Ask+ TakeProfit*_Point,_Digits)。sl=NormalizeDouble(Bid- StopLoss*_Point,_Digits)。
另外,你不需要将全局变量 tp和sl归零。
你能告诉我为什么订单无法打开。错误130
...
错误130是一个接近的停止。检查它们的最小停止设置距离 - StopLevel
而且,是的,上面已经指出--你的计算方法是不正确的。
我这么做了--没有任何变化(
是的,刚刚宣布。
input double Urov_70=70;
input double Urov_30=30;
input double Lot=0.01;
input int TakeProfit=100;
input int StopLoss=100;
input int MagicNumber=523;
input int slippage=30;
double tp=0,sl=0,OrderBuy=0,OrderSell=0;
int tiket;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
tp=NormalizeDouble(Ask+TakeProfit*_Point,_Digits);
sl=NormalizeDouble(Bid-StopLoss*_Point,_Digits);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
for(int i=0; i<OrdersTotal(); i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
if(OrderSymbol()==_Symbol && OrderMagicNumber()==MagicNumber)
{
if(OrderType()==OP_BUY){}
if(OrderType()==OP_SELL){}
}
}
double rsi=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,0);
double rsi1=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,1);
//+------------------------------------------------------------------+
double StopLossLevel;
double TakeProfitLevel;
if(StopLoss>0) StopLossLevel=Bid-StopLoss*Point; else StopLossLevel=0.0;
if(TakeProfit>0) TakeProfitLevel=Ask+TakeProfit*Point; else TakeProfitLevel=0.0;
///---
if(OrderBuy<1 && rsi>Urov_70 && rsi1<Urov_70)
{
tiket=OrderSend(_Symbol,OP_BUY,Lot,Ask,slippage,sl,tp,NULL,MagicNumber,0,clrBlue);
}
if(OrderSell<1 && rsi<Urov_30 && rsi1>Urov_30)
{
tiket=OrderSend(_Symbol,OP_SELL,Lot,Bid,slippage,sl,tp,NULL,MagicNumber,0,clrRed);
}
}
//+------------------------------------------------------------------+
我这么做了--没有任何变化(
input double Urov_70=70;
input double Urov_30=30;
input double Lot=0.01;
input int TakeProfit=100;
input int StopLoss=100;
input int MagicNumber=523;
input int slippage=30;
double tp=0,sl=0,OrderBuy=0,OrderSell=0;
int tiket;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
tp=NormalizeDouble(Ask+TakeProfit*_Point,_Digits);
sl=NormalizeDouble(Bid-StopLoss*_Point,_Digits);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
for(int i=0; i<OrdersTotal(); i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
if(OrderSymbol()==_Symbol && OrderMagicNumber()==MagicNumber)
{
if(OrderType()==OP_BUY){}
if(OrderType()==OP_SELL){}
}
}
double rsi=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,0);
double rsi1=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,1);
//+------------------------------------------------------------------+
double StopLossLevel;
double TakeProfitLevel;
if(StopLoss>0) StopLossLevel=Bid-StopLoss*Point; else StopLossLevel=0.0;
if(TakeProfit>0) TakeProfitLevel=Ask+TakeProfit*Point; else TakeProfitLevel=0.0;
///---
if(OrderBuy<1 && rsi>Urov_70 && rsi1<Urov_70)
{
tiket=OrderSend(_Symbol,OP_BUY,Lot,Ask,slippage,sl,tp,NULL,MagicNumber,0,clrBlue);
}
if(OrderSell<1 && rsi<Urov_30 && rsi1>Urov_30)
{
tiket=OrderSend(_Symbol,OP_SELL,Lot,Bid,slippage,sl,tp,NULL,MagicNumber,0,clrRed);
}
}
//+------------------------------------------------------------------+
将止损点的计算移到本体上。
sl=NormalizeDouble(Bid-StopLoss*_Point,_Digits);
..
tp=NormalizeDouble(Ask+TakeProfit*_Point,_Digits);
sl=NormalizeDouble(Bid-StopLoss*_Point,_Digits)。
这是OP_BUY的变体。
为OP_SELL
tp=NormalizeDouble(Bid-TakeProfit*_Point,_Digits)。
sl=NormalizeDouble(Ask+StopLoss*_Point,_Digits)。错误148。每一次打勾,它都会打开。
input double Urov_70=70;
input double Urov_30=30;
input double Lot=0.01;
input int TakeProfit=100;
input int StopLoss=100;
input int MagicNumber=523;
input int slippage=30;
double tp,sl,OrderBuy=0,OrderSell=0;
int tiket;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
for(int i=0; i<OrdersTotal(); i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
if(OrderSymbol()==_Symbol && OrderMagicNumber()==MagicNumber)
{
if(OrderType()==OP_BUY){}
if(OrderType()==OP_SELL){}
}
}
double rsi=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,0);
double rsi1=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,1);
//+------------------------------------------------------------------+
double StopLossLevel;
double TakeProfitLevel;
if(StopLoss>0) StopLossLevel=Bid-StopLoss*Point; else StopLossLevel=0.0;
if(TakeProfit>0) TakeProfitLevel=Ask+TakeProfit*Point; else TakeProfitLevel=0.0;
tp=NormalizeDouble(Ask+TakeProfit*_Point,_Digits);
sl=NormalizeDouble(Bid-StopLoss*_Point,_Digits);
tp=NormalizeDouble(Bid-TakeProfit*_Point,_Digits);
sl=NormalizeDouble(Ask+StopLoss*_Point,_Digits);
///---
if(OrderBuy<1 && rsi>Urov_70 && rsi1<Urov_70)
{
tiket=OrderSend(_Symbol,OP_BUY,Lot,Ask,slippage,sl,tp,NULL,MagicNumber,0,clrBlue);
}
if(OrderSell<1 && rsi<Urov_30 && rsi1>Urov_30)
{
tiket=OrderSend(_Symbol,OP_SELL,Lot,Bid,slippage,sl,tp,NULL,MagicNumber,0,clrRed);
}
}
//+------------------------------------------------------------------+
两个不同的sl tp值
以不同的方式称呼它们:slSell , slBuy, tpSell, tpBuy
两个不同的sl tp值
以不同的方式称呼它们:slSell , slBuy, tpSell, tpBuy
没有帮助(
double slSell,slBuy,tpSell,tpBuy;
int tiket;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
for(int i=0; i<OrdersTotal(); i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
if(OrderSymbol()==_Symbol && OrderMagicNumber()==MagicNumber)
{
if(OrderType()==OP_BUY){}
if(OrderType()==OP_SELL){}
}
}
double rsi=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,0);
double rsi1=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,1);
//+------------------------------------------------------------------+
double StopLossLevel;
double TakeProfitLevel;
if(StopLoss>0) StopLossLevel=Bid-StopLoss*Point; else StopLossLevel=0.0;
if(TakeProfit>0) TakeProfitLevel=Ask+TakeProfit*Point; else TakeProfitLevel=0.0;
tpBuy=NormalizeDouble(Ask+TakeProfit*_Point,_Digits);
slBuy=NormalizeDouble(Bid-StopLoss*_Point,_Digits);
tpSell=NormalizeDouble(Bid-TakeProfit*_Point,_Digits);
slSell=NormalizeDouble(Ask+StopLoss*_Point,_Digits);
///---
if(OrderBuy<1 && rsi>Urov_70 && rsi1<Urov_70)
{
tiket=OrderSend(_Symbol,OP_BUY,Lot,Ask,slippage,sl,tp,NULL,MagicNumber,0,clrBlue);
}
if(OrderSell<1 && rsi<Urov_30 && rsi1>Urov_30)
{
tiket=OrderSend(_Symbol,OP_SELL,Lot,Bid,slippage,sl,tp,NULL,MagicNumber,0,clrRed);
}
}
//+------------------------------------------------------------------+