MQL4 및 MQL5에 대한 초보자 질문, 알고리즘 및 코드에 대한 도움말 및 토론 - 페이지 60 1...535455565758596061626364656667...1953 새 코멘트 Anarchist 2017.01.08 17:29 #591 Sergey Gritsay : 마감 주문 수정을 위해 블록에 잼이있었습니다. 정말 감사합니다 지금 확인하겠습니다! [삭제] 2017.01.08 17:55 #592 주문이 열리지 않는 이유를 알려주세요. 오류 130 을 제공합니다. 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 (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 PROBLEM [Archive!] Any rookie question, RichLux 2017.01.08 18:04 #593 나는 전문가가 아닙니다. 틀릴 수 있습니다! 여기 라인이 있습니다 tp= NormalizeDouble (TakeProfit* _Point , _Digits ); sl= NormalizeDouble (StopLoss* _Point , _Digits ); 하면 더 명확해질 것입니다. tp= NormalizeDouble ( 묻기 + TakeProfit* _Point , _Digits ); sl= NormalizeDouble ( 입찰가 - 손절매* _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 [Archive!] Any rookie question, 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 ( +TakeProfit* _Point , _Digits 묻기 ) ; sl= NormalizeDouble ( 입찰가 -StopLoss* _Point , _Digits ); OP_BUY를 위한 옵션입니다. OP_SELL용 tp= NormalizeDouble ( 입찰가 -TakeProfit* _Point , _Digits ); sl= NormalizeDouble ( + 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 [Archive!] Any rookie question, RSI EA code help 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 [Archive!] Any rookie question, Questions from Beginners MQL4 1...535455565758596061626364656667...1953 새 코멘트 트레이딩 기회를 놓치고 있어요: 무료 트레이딩 앱 복사용 8,000 이상의 시그널 금융 시장 개척을 위한 경제 뉴스 등록 로그인 공백없는 라틴 문자 비밀번호가 이 이메일로 전송될 것입니다 오류 발생됨 Google으로 로그인 웹사이트 정책 및 이용약관에 동의합니다. 계정이 없으시면, 가입하십시오 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 ( 묻기 + TakeProfit* _Point , _Digits );sl= NormalizeDouble ( 입찰가 - 손절매* _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 ( +TakeProfit* _Point , _Digits 묻기 ) ;
sl= NormalizeDouble ( 입찰가 -StopLoss* _Point , _Digits );
OP_BUY를 위한 옵션입니다.
OP_SELL용
tp= NormalizeDouble ( 입찰가 -TakeProfit* _Point , _Digits );
sl= NormalizeDouble ( + 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 );
}
}
//+------------------------------------------------------------------+