アスク! - ページ 117 1...110111112113114115116117118119120121122123124...182 新しいコメント IN10TION 2008.06.18 10:52 #1161 int start(){ if(TimeCurrent()>D'2008.07.01 12:00:00'){Comment("EXPIRED"); return(0);}. ... return(0)。 } amatrader: EAに日付制限を設けることが可能かどうか教えてください。つまり、EAに有効期限を設定し、設定した日付に達すると取引を停止することが可能かどうかということです。 おそらく、次のような内容でしょう。 日付をチェックし、もし日付が(設定した日付)と同じかより大きければ、何もしない。 これは英語版なので、MQL4版が必要です(笑) 誰かが助けることができる場合は、ありがとうございます。 Sergey Golubev 2008.06.18 11:06 #1162 amatrader: EAに日付制限を設けることが可能かどうか教えてください。私が言いたいのは、EAに有効期限を設定し、設定した日付に達すると取引を停止することができるかということです。 おそらく、次のような内容でしょう。 日付をチェックし、もし日付が(設定した日付)と同じかより大きければ、何もしない。 これは英語版なので、MQL4版が必要です(笑) 誰かが助けることができればありがとうございます。 このスレッドを見てくださいhttps://www.mql5.com/en/forum/174194 削除済み 2008.06.18 12:00 #1163 ありがとうございます...とても感謝しています。 LGH 2008.06.18 15:18 #1164 週足のHigh Lowです。 どなたか日足に添付されているような週足のHigh Lowインジケータを投稿していただけませんか? もしくは、添付のものを週足に変えてください。 よろしくお願いします。 ファイル: daily_high_low_.mq4 4 kb Sergey Golubev 2008.06.18 16:04 #1165 このインディケータを使うhttps://www.mql5.com/en/forum/173574/page32(日足、週足、月足です)。 またはこちらhttps://www.mql5.com/en/forum/177792 またはこちらhttps://www.mql5.com/en/forum/178698 forexcel 2008.06.19 01:42 #1166 皆さん、こんにちは。 私が使っているEAはこちらです。BUY-STOPとSELL_STOPを同時に発動させるために、何を変更すればよいか教えてください。今のやり方では、バイストップかセルストップのどちらかがトリガーされますが、両方が欲しいです。次に、各ローソク足の注文 数を制限するにはどうしたらよいでしょうか。 よろしくお願いします。 以下はそのコードです。 void start() { //----履歴と取引をチェックする if(Bars<100 || IsTradeAllowed()==false) return; co=CalculateCurrentOrders(Symbol())。 CheckForSignals(); if (co>0) CheckForClose(); CheckForOpen(); co=CalculateCurrentOrders(Symbol())。 if (mkt>0) { (mkt>0) BreakEvenStop(BreakEven,0)。 double pcnt =( (AccountEquity()-AccountBalance()))/ AccountBalance())*100。 Print("口座資本 = ",AccountEquity()); Print("口座残高 = ",AccountBalance()); if(pcnt>EquityGainPercent) { int total = OrdersTotal(); for(int i=total-1;i>=0;i--) { OrderSelect(i, SELECT_BY_POS); int type = OrderType(); bool result = false; switch(type) { //オープンしたロングポジションをクローズ case OP_BUY : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red ); ブレーク //オープンしたショートポジションをクローズ case OP_SELL : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Red ); ブレーク //保留中の注文を決済 ケース OP_BUYLIMIT : ケース OP_BUYSTOP : ケース OP_SELLLIMIT : case OP_SELLSTOP : result = OrderDelete( OrderTicket() ); } if(result == false) { Alert("Order " , OrderTicket() , " failed to close.Error:", GetLastError() ); Sleep(3000); } } Print("ALL ORDERS CLOSE-->Locked in on Profits"); return(0); } } //+------------------------------------------------------------------+ ///オープンポジションの計算 //+------------------------------------------------------------------+ int CalculateCurrentOrders(string symbol) { int ord; mkt=0; //---- for(int i=0;i<OrdersTotal();i++){。 if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) continue; if(OrderSymbol()==symbol && OrderMagicNumber()==MagicNumber) { (オーダーシンボル()==シンボル && オーダーマジック()==マジックナンバー) ord++; if (OrderType()==OP_BUY || OrderType()==OP_SELL) mkt++; } } //---- 注文数を返す return(ord); } //+------------------------------------------------------------------+ //| 未決済の注文条件を確認する| //+------------------------------------------------------------------+ void CheckForSignals() { (シグナルチェック) //ロング、ショート、エグジットシグナルをチェック buysig=false; sellsig=false; closebuy=false; closesell=false; remorder=false。 int isins,isouts,iskeyrev,is2brev; if (InsideBar) isins=IsInsideBar(shift); if (OutSideBar) isouts=IsOutSideBar(shift)。 if (KeyReversalBar) iskeyrev=IsKeyReversalBar(shift)とする。 if (TwoBarReversal) is2brev=IsTwoBarReversal(シフト); //ロングエントリーシグナル条件 if (isins>0 || isouts>0 || iskeyrev>0 || is2brev>0) {. buysig=true; closesell=true。 } //ショートエントリーシグナル if (isins<0 || isouts<0 || iskeyrev<0 || is2brev<0) {。 buysig=false。 sellsig=true; closebuy=true。 } if (last>0 && (Time[0]-last)/(Period()*60)>=CancelOrderBars) {。 remorder=true。 } } void CheckForOpen() { int res,tr; //---- 売り条件 co=CalculateCurrentOrders(Symbol())。 if(sellsig && lastsig!=-1) { (売り条件) co=CalculateCurrentOrders(Symbol())。 if (co=0){。 res = OpenStop(OP_SELLSTOP,LotsRisk(StopLoss), Low[shift]-OrderPipsDiff*Point, StopLoss, TakeProfit1); } lastsig=-1; last=Time[0]; を返します。 } //---- 買いの条件 if(buysig && lastsig!=1) { { {(buysig && lastsig!=1) co=CalculateCurrentOrders(Symbol())。 if (co==0) res = OpenStop(OP_BUYSTOP,LotsRisk(StopLoss), High[shift]+OrderPipsDiff*Point, StopLoss, TakeProfit1)とします。 } last=Time[0]; lastsig=1; を返します。 } } void BreakEvenStop(int BES, int BELP) { //ストップロスを移動して利益を確定。 //ストップロスを移動して利益確定 bool bres; ダブルストップロス if ( BES > 2 ) { for (int i = 0; i < OrdersTotal(); i++) { { { {オーダーセレクト(i) = 0; i < オーダーセレクト(i); i++) if ( オーダーセレクト (i, SELECT_BY_POS) == false ) continue; if ( OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber ) continue; if ( オーダータイプ() == OP_BUY ) { if ( Bid < OrderOpenPrice()+BES*Point ) continue; StopLoss = OrderOpenPrice()+BELP*Point ) continue; if ( Bid < OrderOpenPrice()+BES*Point ) continue; if ( ストップロス > オーダーストップロス() ){ bres=OrderModify (OrderTicket(), OrderOpenPrice(), StopLoss, OrderTakeProfit(), 0, White); if (!bres) Print("Error Modifying BUY order :",ErrorDescription(GetLastError()))。 } if ( OrderType() == OP_SELL ) { もし、アスク>オーダーオープン if ( Ask > OrderOpenPrice()-BES*Point ) continue; StopLoss = OrderOpenPrice()-BELP*Point; if ( StopLoss < OrderStopLoss() ){ bres=OrderModify (OrderTicket(), OrderOpenPrice(), StopLoss, OrderTakeProfit(), 0, Gold); if (!bres) Print("Error Modifying SELL order :",ErrorDescription(GetLastError()))。 } } } } を返します。 } int IsKeyReversalBar(int shift) { //キーリバーサルバー。 //キーリバーサルバーは、キーバーの始値が前のバーの高値より少なくとも?ピップス高くなければなりません。 //キーバーの終値は、前のバーの高値と終値の間にあるべきです。現在のバーの始値は //キーバーの終値より低くなければならない。SellStop注文は、キーバーの安値に発注されなければならない。 //次の4つのバーで執行されない場合は、注文をキャンセルします。下の画像を見てください。 if (Open[shift]=Low[shift+1] && Close[shift]Close[shift]) return(1); if (Open[shift]>High[shift+1] && Close[shift]=Close[shift+1] && Open[shift-1]<Close[shift]) return(-1); if (Open[shift]>High[shift+1] && Close[shift]<Close[shift]) return(1); return(0)となります。 } int IsTwoBarReversal(int shift) { {/twoバーリバーサル(int shift) 最初のバーのオープンは前のバーの安値の近くにあり、クローズはもっと低く、//良いサイズのボディを持っている必要があります。 //良いサイズのボディを持っています。2本目のバーの始値は、1本目のバーの終値に非常に近くなければなりませんが、両方とも、それぞれのバーの中間点よりかなり下でなければなりません。 //終値は2本前の安値に非常に近く、各バーの中間点である。買い停止注文は、次のバーの高値に置く必要があります。 //もし4本以内に執行されない場合は、注文をキャンセルしてください。以下の画像を参照してください。 if (MathAbs(Open[shift+1]-Close[shift+1])> MathAbs(Open[shift+1]-Low[shift+2])<= (MathAbs(Open[shift+1]-Close[shift+1])> MathAbs(Open[shift+1]-Low[shift+2])) MathAbs(Close[shift]-Low[shift+2])<=(シフト) MathAbs(Open[shift]-Close[shift+1])&&(Close[shift+1]) Close[shift+1]<(High[shift+1]+Low[shift+1])/2 && Open[shift]<(High[shift]+Low[shift])/2)とする。 return(1); if (MathAbs(Open[shift+1]-Close[shift+1])> MathAbs(Open[shift+1]-High[shift+2])<= (MathAbs(Open[shift+1]-High[shift+2])) MathAbs(Close[shift]-Low[shift+2])←←これ MathAbs(Open[shift]-Close[shift+1])&&(Close[shift+1]) Close[shift+1]>(High[shift+1]+Low[shift+1])/2 && Open[shift]>(High[shift]+Low[shift])/2) return(-1); return(0)とする。 } int OpenStop(int mode,double lot, double prc, int SL, int TP) { (int res,tr,col). int res,tr,col; 文字列メール double openprice,sl,tp,stlev; tries=0; stlev=(1+MarketInfo(Symbol(),MODE_STOPLEVEL))*Point; while (res<=0 && tries<OrderTriesNumber) {。 tr=0; while (tr<5 && IsTradeAllowed()) { tr++; Sleep(2000); }. RefreshRates(); if (モード==OP_SELLSTOP) {。 if (prc<=Bid-stlev) openprice=prc; else openprice=Bid-stlev; if (SL>0) sl=openprice+SL*Point; if (TP>0) tp=openprice-TP*Point;col=Red; } else if (モード==OP_BUYSTOP) {。 if (prc>=Ask+stlev) openprice=prc; else openprice=Ask+stlev; if (SL>0) sl=openprice-SL*Point; if (TP>0) tp=openprice+TP*Point;col=Blue; } else return; Print(Ask," ",Bid," ",Symbol()," ",mode," ",lot," ",openprice," ",sl," ",tp," ").print()を実行します。 res=OrderSend(Symbol(),mode,lot,openprice,slippage,sl,tp,EAName+"_"+MagicNumber,MagicNumber,0,col).を実行します。 tries++; } if (res<=0) Print("Error opening pending order :",ErrorDescription(GetLastError()))。 return(res); void CheckForClose() { bool bres; int tr; for(int i=0;i<オーダートータル();i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) continue; if(OrderMagicNumber()!=MagicNumber || OrderSymbol()!=Symbol()) continue; if(OrderMagicNumber()!=MagicNumber || OrderSymbol()!=Symbol()) continue; //---- オーダータイプのチェック if(OrderType()==OP_BUY && closebuy) { (オーダータイプ()==OP_BUY && closebuy) bres=CloseAtMarket(OrderTicket(),OrderLots())。 を続けてください。 if(OrderType()==OP_SELL && closesell) { (オーダータイプ()==OP_SELL &&クローズセル) bres=CloseAtMarket(OrderTicket(),OrderLots())です。 続行します。 if(OrderType()==OP_BUYSTOP && (closebuy || remorder)) { bres=DeletePending bres=DeletePending(OrderTicket())。 continue; if(OrderType()==OP_SELLSTOP && (closesell || remorder)) { { bres=DeletePending(OrderTicket()); continue; }. bres=DeletePending(OrderTicket())。 continue; } } } bool DeletePending(int ticket) { (ブール デリートペンディング) bool bres=false; int tr; tries=0; while (!bres && tries<OrderTriesNumber){。 bres=OrderDelete(ticket)です. tries++; tr=0; while (tr<5 && !IsTradeAllowed()) { tr++; Sleep(2000); }. if (!bres) Print("Error deleting order :",ErrorDescription(GetLastError()))です。 return (bres); } コーディングの方法は? Ask! How to code? gcgipson 2008.06.21 01:35 #1167 どなたか、特定の口座番号 でしかEAを動かせないようにするコードをご存じないでしょうか? ありがとうございます。 Sergey Golubev 2008.06.21 04:21 #1168 それはこちらhttps://www.mql5.com/en/forum/174194(投稿番号: 7) Sergey Golubev 2008.06.21 07:35 #1169 あなたは、この1つをあまりにも多く持っている } gcgipson 2008.06.21 07:48 #1170 newdigital: こちらですhttps://www.mql5.com/en/forum/174194(投稿番号7) newdigitalさん、ありがとうございます。 私は初期化コード(その中に時間切れがある)を次のように設定しています。 int init() {if (TimeCurrent()>D'2008.06.07 12:00:00'){Comment("please renew your subscription"); return(0);}. return(0)。 } if (Account != AccountNumber()){。 Comment("口座での取引 : "+AccountNumber()+" FORBIDDEN!")。 return(0); }else {Comment("");}。 そして今、こんなエラーが返ってきています。 '}'- アンバランスな括弧 というエラーが出てしまいます。 また、「int Account = 111111;」はEAの設定に合うのでしょうか? ありがとうございます。 Ask! EAをLOCK/暗号化する方法 How to LOCK/Encrypt EA 1...110111112113114115116117118119120121122123124...182 新しいコメント 取引の機会を逃しています。 無料取引アプリ 8千を超えるシグナルをコピー 金融ニュースで金融マーケットを探索 新規登録 ログイン スペースを含まないラテン文字 このメールにパスワードが送信されます エラーが発生しました Googleでログイン WebサイトポリシーおよびMQL5.COM利用規約に同意します。 新規登録 MQL5.com WebサイトへのログインにCookieの使用を許可します。 ログインするには、ブラウザで必要な設定を有効にしてください。 ログイン/パスワードをお忘れですか? Googleでログイン
int start(){
if(TimeCurrent()>D'2008.07.01 12:00:00'){Comment("EXPIRED"); return(0);}.
...
return(0)。
}
EAに日付制限を設けることが可能かどうか教えてください。つまり、EAに有効期限を設定し、設定した日付に達すると取引を停止することが可能かどうかということです。
おそらく、次のような内容でしょう。
日付をチェックし、もし日付が(設定した日付)と同じかより大きければ、何もしない。
これは英語版なので、MQL4版が必要です(笑)
誰かが助けることができる場合は、ありがとうございます。EAに日付制限を設けることが可能かどうか教えてください。私が言いたいのは、EAに有効期限を設定し、設定した日付に達すると取引を停止することができるかということです。
おそらく、次のような内容でしょう。
日付をチェックし、もし日付が(設定した日付)と同じかより大きければ、何もしない。
これは英語版なので、MQL4版が必要です(笑)
誰かが助けることができればありがとうございます。このスレッドを見てくださいhttps://www.mql5.com/en/forum/174194
ありがとうございます...とても感謝しています。
週足のHigh Lowです。
どなたか日足に添付されているような週足のHigh Lowインジケータを投稿していただけませんか?
もしくは、添付のものを週足に変えてください。
よろしくお願いします。
このインディケータを使うhttps://www.mql5.com/en/forum/173574/page32(日足、週足、月足です)。
またはこちらhttps://www.mql5.com/en/forum/177792
またはこちらhttps://www.mql5.com/en/forum/178698
皆さん、こんにちは。
私が使っているEAはこちらです。BUY-STOPとSELL_STOPを同時に発動させるために、何を変更すればよいか教えてください。今のやり方では、バイストップかセルストップのどちらかがトリガーされますが、両方が欲しいです。次に、各ローソク足の注文 数を制限するにはどうしたらよいでしょうか。
よろしくお願いします。
以下はそのコードです。
void start() {
//----履歴と取引をチェックする
if(Bars<100 || IsTradeAllowed()==false) return;
co=CalculateCurrentOrders(Symbol())。
CheckForSignals();
if (co>0) CheckForClose();
CheckForOpen();
co=CalculateCurrentOrders(Symbol())。
if (mkt>0) { (mkt>0)
BreakEvenStop(BreakEven,0)。
double pcnt =( (AccountEquity()-AccountBalance()))/ AccountBalance())*100。
Print("口座資本 = ",AccountEquity());
Print("口座残高 = ",AccountBalance());
if(pcnt>EquityGainPercent)
{
int total = OrdersTotal();
for(int i=total-1;i>=0;i--)
{
OrderSelect(i, SELECT_BY_POS);
int type = OrderType();
bool result = false;
switch(type)
{
//オープンしたロングポジションをクローズ
case OP_BUY : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red );
ブレーク
//オープンしたショートポジションをクローズ
case OP_SELL : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Red );
ブレーク
//保留中の注文を決済
ケース OP_BUYLIMIT :
ケース OP_BUYSTOP :
ケース OP_SELLLIMIT :
case OP_SELLSTOP : result = OrderDelete( OrderTicket() );
}
if(result == false)
{
Alert("Order " , OrderTicket() , " failed to close.Error:", GetLastError() );
Sleep(3000);
}
}
Print("ALL ORDERS CLOSE-->Locked in on Profits");
return(0);
}
}
//+------------------------------------------------------------------+
///オープンポジションの計算
//+------------------------------------------------------------------+
int CalculateCurrentOrders(string symbol)
{
int ord; mkt=0;
//----
for(int i=0;i<OrdersTotal();i++){。
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) continue;
if(OrderSymbol()==symbol && OrderMagicNumber()==MagicNumber) { (オーダーシンボル()==シンボル && オーダーマジック()==マジックナンバー)
ord++;
if (OrderType()==OP_BUY || OrderType()==OP_SELL) mkt++;
}
}
//---- 注文数を返す
return(ord);
}
//+------------------------------------------------------------------+
//| 未決済の注文条件を確認する|
//+------------------------------------------------------------------+
void CheckForSignals() { (シグナルチェック)
//ロング、ショート、エグジットシグナルをチェック
buysig=false;
sellsig=false;
closebuy=false;
closesell=false;
remorder=false。
int isins,isouts,iskeyrev,is2brev;
if (InsideBar) isins=IsInsideBar(shift);
if (OutSideBar) isouts=IsOutSideBar(shift)。
if (KeyReversalBar) iskeyrev=IsKeyReversalBar(shift)とする。
if (TwoBarReversal) is2brev=IsTwoBarReversal(シフト);
//ロングエントリーシグナル条件
if (isins>0 || isouts>0 || iskeyrev>0 || is2brev>0) {.
buysig=true;
closesell=true。
}
//ショートエントリーシグナル
if (isins<0 || isouts<0 || iskeyrev<0 || is2brev<0) {。
buysig=false。
sellsig=true;
closebuy=true。
}
if (last>0 && (Time[0]-last)/(Period()*60)>=CancelOrderBars) {。
remorder=true。
}
}
void CheckForOpen() {
int res,tr;
//---- 売り条件
co=CalculateCurrentOrders(Symbol())。
if(sellsig && lastsig!=-1) { (売り条件)
co=CalculateCurrentOrders(Symbol())。
if (co=0){。
res = OpenStop(OP_SELLSTOP,LotsRisk(StopLoss), Low[shift]-OrderPipsDiff*Point, StopLoss, TakeProfit1);
}
lastsig=-1;
last=Time[0];
を返します。
}
//---- 買いの条件
if(buysig && lastsig!=1) { { {(buysig && lastsig!=1)
co=CalculateCurrentOrders(Symbol())。
if (co==0)
res = OpenStop(OP_BUYSTOP,LotsRisk(StopLoss), High[shift]+OrderPipsDiff*Point, StopLoss, TakeProfit1)とします。
}
last=Time[0];
lastsig=1;
を返します。
}
}
void BreakEvenStop(int BES, int BELP) { //ストップロスを移動して利益を確定。
//ストップロスを移動して利益確定
bool bres;
ダブルストップロス
if ( BES > 2 ) {
for (int i = 0; i < OrdersTotal(); i++) { { { {オーダーセレクト(i) = 0; i < オーダーセレクト(i); i++)
if ( オーダーセレクト (i, SELECT_BY_POS) == false ) continue;
if ( OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber ) continue;
if ( オーダータイプ() == OP_BUY ) {
if ( Bid < OrderOpenPrice()+BES*Point ) continue;
StopLoss = OrderOpenPrice()+BELP*Point ) continue; if ( Bid < OrderOpenPrice()+BES*Point ) continue;
if ( ストップロス > オーダーストップロス() ){
bres=OrderModify (OrderTicket(), OrderOpenPrice(), StopLoss, OrderTakeProfit(), 0, White);
if (!bres) Print("Error Modifying BUY order :",ErrorDescription(GetLastError()))。
}
if ( OrderType() == OP_SELL ) { もし、アスク>オーダーオープン
if ( Ask > OrderOpenPrice()-BES*Point ) continue;
StopLoss = OrderOpenPrice()-BELP*Point;
if ( StopLoss < OrderStopLoss() ){
bres=OrderModify (OrderTicket(), OrderOpenPrice(), StopLoss, OrderTakeProfit(), 0, Gold);
if (!bres) Print("Error Modifying SELL order :",ErrorDescription(GetLastError()))。
}
}
}
}
を返します。
}
int IsKeyReversalBar(int shift) { //キーリバーサルバー。
//キーリバーサルバーは、キーバーの始値が前のバーの高値より少なくとも?ピップス高くなければなりません。
//キーバーの終値は、前のバーの高値と終値の間にあるべきです。現在のバーの始値は
//キーバーの終値より低くなければならない。SellStop注文は、キーバーの安値に発注されなければならない。
//次の4つのバーで執行されない場合は、注文をキャンセルします。下の画像を見てください。
if (Open[shift]=Low[shift+1] && Close[shift]Close[shift]) return(1);
if (Open[shift]>High[shift+1] && Close[shift]=Close[shift+1] && Open[shift-1]<Close[shift]) return(-1); if (Open[shift]>High[shift+1] && Close[shift]<Close[shift]) return(1);
return(0)となります。
}
int IsTwoBarReversal(int shift) { {/twoバーリバーサル(int shift)
最初のバーのオープンは前のバーの安値の近くにあり、クローズはもっと低く、//良いサイズのボディを持っている必要があります。
//良いサイズのボディを持っています。2本目のバーの始値は、1本目のバーの終値に非常に近くなければなりませんが、両方とも、それぞれのバーの中間点よりかなり下でなければなりません。
//終値は2本前の安値に非常に近く、各バーの中間点である。買い停止注文は、次のバーの高値に置く必要があります。
//もし4本以内に執行されない場合は、注文をキャンセルしてください。以下の画像を参照してください。
if (MathAbs(Open[shift+1]-Close[shift+1])> MathAbs(Open[shift+1]-Low[shift+2])<= (MathAbs(Open[shift+1]-Close[shift+1])> MathAbs(Open[shift+1]-Low[shift+2]))
MathAbs(Close[shift]-Low[shift+2])<=(シフト)
MathAbs(Open[shift]-Close[shift+1])&&(Close[shift+1])
Close[shift+1]<(High[shift+1]+Low[shift+1])/2 &&
Open[shift]<(High[shift]+Low[shift])/2)とする。
return(1);
if (MathAbs(Open[shift+1]-Close[shift+1])> MathAbs(Open[shift+1]-High[shift+2])<= (MathAbs(Open[shift+1]-High[shift+2]))
MathAbs(Close[shift]-Low[shift+2])←←これ
MathAbs(Open[shift]-Close[shift+1])&&(Close[shift+1])
Close[shift+1]>(High[shift+1]+Low[shift+1])/2 &&
Open[shift]>(High[shift]+Low[shift])/2)
return(-1);
return(0)とする。
}
int OpenStop(int mode,double lot, double prc, int SL, int TP) { (int res,tr,col).
int res,tr,col;
文字列メール
double openprice,sl,tp,stlev;
tries=0;
stlev=(1+MarketInfo(Symbol(),MODE_STOPLEVEL))*Point;
while (res<=0 && tries<OrderTriesNumber) {。
tr=0; while (tr<5 && IsTradeAllowed()) { tr++; Sleep(2000); }.
RefreshRates();
if (モード==OP_SELLSTOP) {。
if (prc<=Bid-stlev) openprice=prc;
else openprice=Bid-stlev;
if (SL>0) sl=openprice+SL*Point;
if (TP>0) tp=openprice-TP*Point;col=Red;
} else
if (モード==OP_BUYSTOP) {。
if (prc>=Ask+stlev) openprice=prc;
else openprice=Ask+stlev;
if (SL>0) sl=openprice-SL*Point;
if (TP>0) tp=openprice+TP*Point;col=Blue;
} else return;
Print(Ask," ",Bid," ",Symbol()," ",mode," ",lot," ",openprice," ",sl," ",tp," ").print()を実行します。
res=OrderSend(Symbol(),mode,lot,openprice,slippage,sl,tp,EAName+"_"+MagicNumber,MagicNumber,0,col).を実行します。
tries++;
}
if (res<=0) Print("Error opening pending order :",ErrorDescription(GetLastError()))。
return(res);
void CheckForClose() {
bool bres; int tr;
for(int i=0;i<オーダートータル();i++) {
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) continue;
if(OrderMagicNumber()!=MagicNumber || OrderSymbol()!=Symbol()) continue; if(OrderMagicNumber()!=MagicNumber || OrderSymbol()!=Symbol()) continue;
//---- オーダータイプのチェック
if(OrderType()==OP_BUY && closebuy) { (オーダータイプ()==OP_BUY && closebuy)
bres=CloseAtMarket(OrderTicket(),OrderLots())。
を続けてください。
if(OrderType()==OP_SELL && closesell) { (オーダータイプ()==OP_SELL &&クローズセル)
bres=CloseAtMarket(OrderTicket(),OrderLots())です。
続行します。
if(OrderType()==OP_BUYSTOP && (closebuy || remorder)) { bres=DeletePending
bres=DeletePending(OrderTicket())。
continue;
if(OrderType()==OP_SELLSTOP && (closesell || remorder)) { { bres=DeletePending(OrderTicket()); continue; }.
bres=DeletePending(OrderTicket())。
continue;
}
}
}
bool DeletePending(int ticket) { (ブール デリートペンディング)
bool bres=false; int tr;
tries=0;
while (!bres && tries<OrderTriesNumber){。
bres=OrderDelete(ticket)です.
tries++;
tr=0; while (tr<5 && !IsTradeAllowed()) { tr++; Sleep(2000); }.
if (!bres) Print("Error deleting order :",ErrorDescription(GetLastError()))です。
return (bres);
}
どなたか、特定の口座番号 でしかEAを動かせないようにするコードをご存じないでしょうか? ありがとうございます。
それはこちらhttps://www.mql5.com/en/forum/174194(投稿番号: 7)
あなたは、この1つをあまりにも多く持っている
こちらですhttps://www.mql5.com/en/forum/174194(投稿番号7)
newdigitalさん、ありがとうございます。
私は初期化コード(その中に時間切れがある)を次のように設定しています。
int init()
{if (TimeCurrent()>D'2008.06.07 12:00:00'){Comment("please renew your subscription"); return(0);}.
return(0)。
}
if (Account != AccountNumber()){。
Comment("口座での取引 : "+AccountNumber()+" FORBIDDEN!")。
return(0);
}else {Comment("");}。
そして今、こんなエラーが返ってきています。
'}'- アンバランスな括弧
というエラーが出てしまいます。 また、「int Account = 111111;」はEAの設定に合うのでしょうか? ありがとうございます。