MQL4、MQL5に関する初心者からの質問、アルゴリズムやコードに関するヘルプ、ディスカッションなど。 - ページ 300 1...293294295296297298299300301302303304305306307...1953 新しいコメント Artyom Trishkin 2017.09.05 16:48 #2991 buyanov:しかし、何も変わっていない。エラーと警告の両方が残っています。コードの一部だけでなく、全体を教えてください。みんなに当ててほしい?それならここで聞いてください。ここでは誰もが一度にすべてのことについて知っている のです。 buyanov 2017.09.05 18:11 #2992 全コードをお渡しします。 Automated Trading and Strategy Testing www.mql5.com MQL5: language of trade strategies built-in the MetaTrader 5 Trading Platform, allows writing your own trading robots, technical indicators, scripts and libraries of functions Artyom Trishkin 2017.09.05 18:31 #2993 buyanov:全コードをお渡しします。とにかくデカい...。 buyanov 2017.09.05 18:38 #2994 すべてのコード「」 #property copyright "Copyright 2017、MetaQuotes Software Corp." #property version "Cross20170703 1.00" // =============================================== = ======================== extern int Period_FastMA = 4; extern int Period_SlowMA = 8; extern int MaxTickNum = 30; extern int MaxAttempt = 10; extern int k_slippage = 1; extern double k_SL = 10.0; // * Point() extern double k_TP = 30.0; // * Point() extern double TrailDist = 30.0; // * Point() extern double k_lots = 0.3; extern bool ExFin = false; int // ************************************************** ***** ************************************ res、カウント、私、 NextTick = 0、時間、 fintime、 BegMlSecTime、 EndMlSecTime、デルタタイム、試み、滑り=5、 TickNum = 0、 pos、チケット、 MaxInterval1000、 CrossNum = 0、 comis = 4、 att、試み、エラー;ダブル//************************************************ ***** *******************************合計、たくさん、広める、 fastma、 slowMA、デルタ、最後のデルタ、 PrevDelta、 Comis = 0.00004、 openprice、 closeprice、 SL、 TP、利益、利益; bool // *********************************************** *** ********************************************** FirstCross = false、 NextCross = false、 CurType、 success = true enable = true、 BegUp、 BegDn、 BuyOpened = false、 SellOpened = false;ストリング//*********************************************** ***** ********************************************* **レック、 str、記録、 BegTimeCurrent、 EndTimeCurrent、 CurTime、 StrCur、 stringbeg、 StringEnd; // ************************************************ ** ************************************************ ******* ****** // =============================================== = ================================================ == ============================= // =============================================== = ================================================ == ============================== // =============================================== = ================================================ == ============================== // >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >> >>>>>>>>>>>>>>>>>>>>>>>>>> >> // ------------------------------------------------ -------------------------------------------------- -------------------------- // =============================================== = ================================================ == ========================== int OnDeinit(const int res) {{ Alert( "beg OnDeinit()"); err = StringToInteger((string)err); return(res); Alert( "end OnDeinit()"); } // OnDeinit(); ----------- // ------------------------------------------------ -------------------------------------------------- ----------------------- // =============================================== = ================================================ == =========================== void ExpertStop() {{ Alert( "ExpertStop"); if((ExFin == true)&&(TickNum == MaxTickNum)) {{ ExpertRemove(); OnDeinit(res); } }//ExpertStopを終了します// ------------------------------------------------ -------------------------------------------------- ------------------------ // =============================================== = ================================================ == ======================= int ErrorDescription() {{ Alert( "beg ErrorDescription"); switch(err) {ケース0:err="エラーなし";壊す;ケース1:err = "エラーはありませんが、結果は不明です";壊す;ケース2:err="一般的なエラー";壊す;ケース3:err="無効なパラメータ";壊す;ケース4:err="トレードサーバーがビジーです";壊す;ケース5:err="古いバージョンのクライアント端末";壊す;ケース6:err="トレードサーバーへの接続がありません";壊す;ケース7:err = "Insufficient rights";壊す;ケース8:err="リクエストが多すぎます";壊す;ケース9:err="サーバーを混乱させる不正な操作";壊す;ケース64:err="アカウントがブロックされました";壊す;ケース65:err="アカウント番号が正しくありません";壊す;ケース128:err="取引タイムアウトの期限が切れました";壊す;ケース129:err="価格が正しくありません";壊す;ケース130:err="間違った停止";壊す;ケース131:err="不正確なボリューム";壊す;ケース132:err = "Market Closed";壊す;ケース133:err="取引禁止";壊す;ケース134:err="操作を完了するのに十分なお金がありません";壊す;ケース135:err="価格が変更されました";壊す;ケース136:err="価格なし";壊す;ケース137:err="ブローカービジー";壊す;ケース138:err="新しい価格";壊す;ケース139:err = "注文はブロックされ、すでに処理されています";壊す;ケース140:err="購入のみ許可";壊す;ケース141:err="リクエストが多すぎます";壊す;ケース145:err = "注文が市場に近すぎるため、変更は許可されていません";壊す;ケース146:err="トレーディングサブシステムビジー";壊す;ケース147:err="注文の有効期限の使用はブローカーによって禁止されています";壊す;ケース148:err="未処理および保留中の注文の数がブローカーによって設定された制限に達しました。";break; //ケース4000:err="エラーなし";壊す;ケース4001:err="無効な関数ポインタ";壊す;ケース4002:err="配列インデックスが範囲外です";壊す;ケース4003:err="関数スタック用のメモリがありません";壊す;ケース4004:err="再帰呼び出し後のスタックオーバーフロー";壊す;ケース4005:err="パラメータを渡すためのメモリがスタックにありません";壊す;ケース4006:err="文字列パラメータのメモリ不足";壊す;ケース4007:err="一時文字列のメモリ不足";壊す;ケース4008:err="初期化されていない文字列";壊す;ケース4009:err="配列内の初期化されていない文字列";壊す;ケース4010:err="文字列配列のメモリ不足";壊す;ケース4011:err="文字列が長すぎます";壊す;ケース4012:err="残りゼロ";壊す;ケース4013:err="ゼロ除算";壊す;ケース4014:err="不明なコマンド";壊す;ケース4015:err="不正な遷移";壊す;ケース4016:err="初期化されていない配列";壊す;ケース4017:err="DLL呼び出しは許可されていません";壊す;ケース4018:err="ライブラリを読み込めません";壊す;ケース4019:err="関数を呼び出せません";壊す;ケース4020:err="外部ライブラリ関数の呼び出しは許可されていません";壊す;ケース4021:err="関数から返される文字列に十分なメモリがありません";壊す;ケース4022:err="システムビジー";壊す;ケース4050:err="関数パラメーターの数が無効です";壊す;ケース4051:err="無効な関数パラメーター値";壊す;ケース4052:err="文字列関数の内部エラー";壊す;ケース4053:err="配列エラー";壊す;ケース4054:err="時系列配列の誤った使用";壊す;ケース4055:err=" カスタムインジケータエラー";壊す;ケース4056:err="アレイは互換性がありません";壊す;ケース4057:err="グローバル変数の処理中にエラーが発生しました";壊す;ケース4058:err="グローバル変数が見つかりません";壊す;ケース4059:err="テストモードでは機能が許可されていません";壊す;ケース4060:err="関数は許可されていません";壊す;ケース4061:err="メール送信エラー";壊す;ケース4062:err="文字列パラメータが必要です";壊す;ケース4063:err="整数パラメータが必要です";壊す;ケース4064:err = "double expected";壊す;ケース4065:err="配列はパラメータとして必要です";壊す;ケース4066:err="更新状態の要求された履歴データ";壊す;ケース4067:err="トレード操作の実行中にエラーが発生しました";壊す;ケース4099:err="ファイルの終わり";壊す;ケース4100:err="ファイルの操作中にエラーが発生しました";壊す;ケース4101:err="無効なファイル名";壊す;ケース4102:err="開いているファイルが多すぎます";壊す;ケース4103:err="ファイルを開くことができません";壊す;ケース4104:err="互換性のないファイルアクセスモード";壊す;ケース4105:err="注文が選択されていません";壊す;ケース4106:err="不明な文字";壊す;ケース4107:err="取引関数の価格パラメーターが正しくありません";壊す;ケース4108:err="無効なチケット番号";壊す;ケース4109:err="取引は許可されていません。EAプロパティでEAの取引を許可するオプションを有効にする必要があります。";壊す;ケース4110:err="ロングポジションは許可されていません。EAプロパティを確認する必要があります。";壊す;ケース4111:err="短い位置は許可されていません。EAのプロパティを確認する必要があります。";壊す;ケース4200:err="オブジェクトはすでに存在します";壊す;ケース4201:err="不明なオブジェクトプロパティが要求されました";壊す;ケース4202:err="オブジェクトが存在しません";壊す;ケース4203:err="不明なオブジェクトタイプ";壊す;ケース4204:err="オブジェクト名なし";壊す;ケース4205:err="オブジェクト座標エラー";壊す;ケース4206:err="指定されたサブウィンドウが見つかりませんでした";壊す;デフォルト:err="オブジェクトの操作中にエラーが発生しました"; } Alert( "end ErrorDescription"); return(err); } // End ErrorDescription() // ------------------------------------------------ -------------------------------------------------- ------------------------ // =============================================== = ================================================ == ======================= int GetNext(NextTick) // >> >> >> >> >> >> >> >> >> >> >> >> {{ Alert( "beg GetNext(NextTick)"); Alert(NextTick); while(RefreshRates()== false)Count ++; Alert( "Count ="、Count、 "NextTick ="、NextTick); Alert( ""); Alert(RefreshRates()、Count、NextTick); return(NextTick); Alert(NextTick); // ------------------- Alert( "end GetNext(NextTick)"); } // GetNext(NextTick)を終了します// =============================================== = ================================================ == ======================= // ------------------------------------------------ -------------------------------------------------- ------------------------ void OnTick() {{ // *********************************** Alert( "beg OnTick"); // *********************************** FastMA = NormalizeDouble(iMA(NULL、0、Period_FastMA、0、MODE_SMA、PRICE_CLOSE、1)、Digits()); // Period_FastMA = 4 SlowMA = NormalizeDouble(iMA(NULL、0、Period_SlowMA、0、MODE_SMA、PRICE_CLOSE、1)、Digits()); // Period_SlowMA = 8 GetNext(NextTick); Alert( "NextTick ="、NextTick); Delta = NormalizeDouble(FastMA-SlowMA、Digits()); Alert( "beg OnTick"); Alert(Delta、Digits()); Alert( "FastMA ="、DoubleToStr(FastMA、Digits())、 "SlowMA ="、DoubleToStr(SlowMA、Digits())、 "Delta ="、DoubleToStr(Delta、Digits())); Alert( "end OnTick"); // ------------------------------------------------ -------------------------------------------------- -------------------------- } // end(end OnTick) // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<< // ------------------------------------------------ -------------------------------------------------- ---------------------------- // =============================================== = ================================================ == ========================== void Init() {{ Alert( ""); Alert( "beg Init()"); Alert( ""); StringBeg = StringConcatenate( "TimeToStr(TIME_DATE、TIME_SECONDS)="、TimeToStr(TIME_DATE、TIME_SECONDS)); alert(stringbeg); record = StringConcatenate( "MaxTickNum ="、MaxTickNum); alert(record); record = StringConcatenate( "k_SL ="、DoubleToStr(k_SL、Digits())); alert(record); record = StringConcatenate( "k_TP ="、DoubleToStr(k_TP、Digits())); alert(record); record = StringConcatenate( "k_lots ="、DoubleToStr(k_lots、Digits())); alert(record); Alert( "end Init()"); } // end Init() // ------------------------------------------------ -------------------------------------------------- ------------------------ // =============================================== = ================================================ == ==================== int GetTick(NextTick) {{ Alert( "beg GetTick"); while(RefreshRates()== false) NextTick ++; Alert( "NextTick ="、NextTick); OrderSelect(NextTick、SELECT_BY_TICKET); Profit = OrderProfit(); Alert(DoubleToStr(Profit、Digits)); GetNext(NextTick); Alert( "end GetTick"); } // ------------------------------------------------ -------------------------------------------------- -------------------------------------------------- -------- // =============================================== = ================================================ == ========================= int NextType() //>>>>>>>>>>>>>>>>>>>>>>> {{ Alert( "beg NextType"); if(OrderSelect(NextTick、SELECT_BY_TICKET)== true) {{ OpenPrice = OrderOpenPrice(); ClosePrice = OrderClosePrice(); } if(ClosePrice> OpenPrice)CurType = OP_BUY;それ以外の場合、CurType = OP_SELL; return(curType); Alert( "end CurType()"); //>>>>>>>>>>>>>>>>>>>>>>>>>>> } // "end CurType()"; // ------------------------------------------------ -------------------------------------------------- ---------------------------- // =============================================== = ================================================ == =========================== bool FastMACrossUp() {{ if(!(Delta == LastDelta))Alert( "Delta ="、DoubleToStr(Delta、5)、 "LastDelta ="、DoubleToStr(LastDelta、5)); Alert( "LastDelta ="、DoubleToStr(LastDelta、5)); Alert( "!(Delta == LastDelta)="、!(Delta == LastDelta)); if(((Delta!= LastDelta)&&(Delta> = 0)&&(LastDelta <= 0)))Alert( "(Delta!= LastDelta)&&(Delta> = 0)&&(LastDelta <= 0)=" 、 (Delta!= LastDelta)&&(Delta> = 0)&&(LastDelta <= 0)); Alert( "(Delta> = 0)="、(Delta> = 0)、 "(LastDelta <= 0)="、(LastDelta <= 0)); if(Delta!= LastDelta)Alert( "Delta ="、DoubleToStr(Delta、5)、 "LastDelta ="、DoubleToStr(LastDelta、5)); Alert( "(Delta> = 0)="、(Delta> = 0)、 "(LastDelta <= 0)="、(LastDelta <= 0)、 "TickNum ="、TickNum); Alert( "(Delta> = 0)="、(Delta> = 0)); Alert( "LastDelta <="、(LastDelta <= 0)); Alert( "!(Delta == LastDelta)&&((Delta> = 0)&&(LastDelta <= 0))="、!(Delta == LastDelta)&&((Delta> = 0)&&(LastDelta <= 0 ))); Alert(((Delta!= LastDelta)&&((Delta> = 0)&&(LastDelta <= 0)))); Alert( "(Delta!= LastDelta)="、(Delta!= LastDelta)、 "(Delta> = 0)="、(Delta> = 0)、 "(LastDelta <= 0)="、(LastDelta <= 0)); return((Delta!= LastDelta)&&(Delta> = 0)&&(LastDelta <= 0)); } // FastMACrossUp()を終了します// ------------------------------------------------ -------------------------------------------------- -------------------- // =============================================== = ================================================ == =================== bool FastMACrossDn() {{ if(!(Delta == LastDelta)&&(Delta <= 0)&&(LastDelta> = 0))Alert( "Delta ="、DoubleToStr(Delta、5)、 "LastDelta ="、DoubleToStr(LastDelta、5)) ; Alert( "LastDelta ="、DoubleToStr(LastDelta、5)); Alert( "!(Delta == LastDelta)="、!(Delta == LastDelta)); Alert( "(Delta <= 0)="、(Delta <= 0)); Alert( "LastDelta> = 0"、(LastDelta> = 0)); if((Delta!= LastDelta)&&(Delta <= 0)&&(LastDelta> = 0)) Alert( "(Delta <= 0)="、(Delta <= 0)、 "(LastDelta> = 0)="、(LastDelta> = 0)); Alert( "(Delta!= LastDelta)&&((Delta <= 0)&&(LastDelta> = 0))="、(Delta!= LastDelta)&&(Delta <= 0)&&(LastDelta> = 0)); if(Delta!= LastDelta)Alert( "Delta ="、DoubleToStr(Delta、5)、 "LastDelta ="、DoubleToStr(LastDelta、5)); Alert( "(Delta <= 0)="、(Delta <= 0)、 "(LastDelta> = 0)="、(LastDelta> = 0)、 "TickNum ="、TickNum); Alert( "(Delta!= LastDelta)&&((Delta <= 0)&&(LastDelta> = 0))="、(Delta!= LastDelta)&&((Delta <= 0)&&(LastDelta> = 0)) ); return((Delta!= LastDelta)&&(Delta <= 0)&&(LastDelta> = 0)); } // end FastMACrossDn() // ------------------------------------------------ -------------------------------------------------- -------------------------------------- // =============================================== = ================================================ == ================================== bool FastMAIsAbove() {{ Alert( "beg FastMAIsAbove()"); Alert( "(Delta> = 0)="、(Delta> = 0)、 "(LastDelta> = 0)="、(LastDelta> = 0)); if(((Delta> = 0)&&(LastDelta> = 0))) Alert( "FastMA ="、DoubleToStr(FastMA、5)、 "SlowMA ="、DoubleToStr(SlowMA、5)); Alert( "Delta ="、DoubleToStr(Delta、5)、 "LastDelta ="、DoubleToStr(LastDelta、5)); Alert( "end FastMAIsAbove()"); Alert( "(Delta == LastDelta)&&(Delta> = 0)&&(LastDelta> = 0)="、(Delta == LastDelta)&&(Delta> = 0)&&(LastDelta> = 0)); Alert( "end FastMAIsAbove()"); return((Delta == LastDelta)&&(Delta> = 0)&&(LastDelta> = 0)); } // end FastMAIsAbove() // =============================================== = ================================================ == ================ // ------------------------------------------------ -------------------------------------------------- ------------------ bool FastMAIsBelow() {{ return((Delta == LastDelta)&&(Delta <= 0)&&(LastDelta <= 0)); } // end FastMAIsBelow()* / 「」 // ------------------------------------------------ -------------------------------------------------- ------------------ // ************************************************ ** ***************************************** 「」 Any questions from newcomers Error 130 :S コーディングの方法は? Mihail Marchukajtes 2017.09.05 19:29 #2995 Dmitriy Voevodkin: Initはどのような方法でも開始することはできず、DeInitと同様にインジケータ/エキスパートが起動したときに一度だけ自動的に開始されます。また、静的なブーリアン変数を作り、IsConnected() と共に使用することもできます。そして、新しいティックの到着で接続を回復するとき、最初は独自の初期化関数を起動する必要があります。しかし、IsConnected() はOnCalculate()の中ではなく、OnTimer()の中で使うべきで、私独自の初期化関数はOnCalculate()の一番最初の部分で使うべきです。ありがとうございます!考えてみます!ただ、すでに典型的な解決策があるのでは......と思ってしまいました。 Alekseu Fedotov 2017.09.05 19:33 #2996 buyanov:全てのコード うわー、すごい数のアラートですね。 Artyom Trishkin 2017.09.05 19:34 #2997 Mihail Marchukajtes: ありがとうございます。考えてみます。ただ、典型的な解決策がすでにあるのではと思いました......。この方の言葉には、すでに反論を書かせていただきました。OnItit()は普通の関数です。必要なときに実行する。 Artyom Trishkin 2017.09.05 19:36 #2998 buyanov:全てのコードSRCボタンを使ってコードを添付してください。すみません、完全に学習能力がないのでしょうか?誰がこんなガラクタを見たいと思うのか、教えてください。 Mihail Marchukajtes 2017.09.05 20:40 #2999 Artyom Trishkin:この人の言葉に対する反論は、すでに書いている。OnItit()は通常の関数です。必要なときに実行すればよい。そうですね、そうですね、接続するときにかければいいんじゃないかと。できることがわかりました :-) Victor Nikolaev 2017.09.06 02:06 #3000 buyanov:全てのコード 可変型に注意不要なAlertはすべて捨てる ファイル: test.mq4 42 kb 1...293294295296297298299300301302303304305306307...1953 新しいコメント 取引の機会を逃しています。 無料取引アプリ 8千を超えるシグナルをコピー 金融ニュースで金融マーケットを探索 新規登録 ログイン スペースを含まないラテン文字 このメールにパスワードが送信されます エラーが発生しました Googleでログイン WebサイトポリシーおよびMQL5.COM利用規約に同意します。 新規登録 MQL5.com WebサイトへのログインにCookieの使用を許可します。 ログインするには、ブラウザで必要な設定を有効にしてください。 ログイン/パスワードをお忘れですか? Googleでログイン
しかし、何も変わっていない。
エラーと警告の両方が残っています。
コードの一部だけでなく、全体を教えてください。みんなに当ててほしい?それならここで聞いてください。ここでは誰もが一度にすべてのことについて知っている のです。
全コードをお渡しします。
全コードをお渡しします。
とにかくデカい...。
すべてのコード
「」
#property copyright "Copyright 2017、MetaQuotes Software Corp."
#property version "Cross20170703 1.00"
// =============================================== = ========================
extern int Period_FastMA = 4;
extern int Period_SlowMA = 8;
extern int MaxTickNum = 30;
extern int MaxAttempt = 10;
extern int k_slippage = 1;
extern double k_SL = 10.0; // * Point()
extern double k_TP = 30.0; // * Point()
extern double TrailDist = 30.0; // * Point()
extern double k_lots = 0.3;
extern bool ExFin = false;
int // ************************************************** ***** ************************************
res、
カウント、
私、
NextTick = 0、
時間、
fintime、
BegMlSecTime、
EndMlSecTime、
デルタタイム、
試み、
滑り=5、
TickNum = 0、
pos、
チケット、
MaxInterval1000、
CrossNum = 0、
comis = 4、
att、
試み、
エラー;
ダブル//************************************************ ***** *******************************
合計、
たくさん、
広める、
fastma、
slowMA、
デルタ、
最後のデルタ、
PrevDelta、
Comis = 0.00004、
openprice、
closeprice、
SL、
TP、
利益、
利益;
bool // *********************************************** *** **********************************************
FirstCross = false、
NextCross = false、
CurType、
success = true
enable = true、
BegUp、
BegDn、
BuyOpened = false、
SellOpened = false;
ストリング//*********************************************** ***** ********************************************* **
レック、
str、
記録、
BegTimeCurrent、
EndTimeCurrent、
CurTime、
StrCur、
stringbeg、
StringEnd;
// ************************************************ ** ************************************************ ******* ******
// =============================================== = ================================================ == =============================
// =============================================== = ================================================ == ==============================
// =============================================== = ================================================ == ==============================
// >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >> >>>>>>>>>>>>>>>>>>>>>>>>>> >>
// ------------------------------------------------ -------------------------------------------------- --------------------------
// =============================================== = ================================================ == ==========================
int OnDeinit(const int res)
{{
Alert( "beg OnDeinit()");
err = StringToInteger((string)err);
return(res);
Alert( "end OnDeinit()");
}
// OnDeinit(); -----------
// ------------------------------------------------ -------------------------------------------------- -----------------------
// =============================================== = ================================================ == ===========================
void ExpertStop()
{{
Alert( "ExpertStop");
if((ExFin == true)&&(TickNum == MaxTickNum))
{{
ExpertRemove();
OnDeinit(res);
}
}//ExpertStopを終了します
// ------------------------------------------------ -------------------------------------------------- ------------------------
// =============================================== = ================================================ == =======================
int ErrorDescription()
{{
Alert( "beg ErrorDescription");
switch(err)
{ケース0:err="エラーなし";壊す;
ケース1:err = "エラーはありませんが、結果は不明です";壊す;
ケース2:err="一般的なエラー";壊す;
ケース3:err="無効なパラメータ";壊す;
ケース4:err="トレードサーバーがビジーです";壊す;
ケース5:err="古いバージョンのクライアント端末";壊す;
ケース6:err="トレードサーバーへの接続がありません";壊す;
ケース7:err = "Insufficient rights";壊す;
ケース8:err="リクエストが多すぎます";壊す;
ケース9:err="サーバーを混乱させる不正な操作";壊す;
ケース64:err="アカウントがブロックされました";壊す;
ケース65:err="アカウント番号が正しくありません";壊す;
ケース128:err="取引タイムアウトの期限が切れました";壊す;
ケース129:err="価格が正しくありません";壊す;
ケース130:err="間違った停止";壊す;
ケース131:err="不正確なボリューム";壊す;
ケース132:err = "Market Closed";壊す;
ケース133:err="取引禁止";壊す;
ケース134:err="操作を完了するのに十分なお金がありません";壊す;
ケース135:err="価格が変更されました";壊す;
ケース136:err="価格なし";壊す;
ケース137:err="ブローカービジー";壊す;
ケース138:err="新しい価格";壊す;
ケース139:err = "注文はブロックされ、すでに処理されています";壊す;
ケース140:err="購入のみ許可";壊す;
ケース141:err="リクエストが多すぎます";壊す;
ケース145:err = "注文が市場に近すぎるため、変更は許可されていません";壊す;
ケース146:err="トレーディングサブシステムビジー";壊す;
ケース147:err="注文の有効期限の使用はブローカーによって禁止されています";壊す;
ケース148:err="未処理および保留中の注文の数がブローカーによって設定された制限に達しました。";break;
//
ケース4000:err="エラーなし";壊す;
ケース4001:err="無効な関数ポインタ";壊す;
ケース4002:err="配列インデックスが範囲外です";壊す;
ケース4003:err="関数スタック用のメモリがありません";壊す;
ケース4004:err="再帰呼び出し後のスタックオーバーフロー";壊す;
ケース4005:err="パラメータを渡すためのメモリがスタックにありません";壊す;
ケース4006:err="文字列パラメータのメモリ不足";壊す;
ケース4007:err="一時文字列のメモリ不足";壊す;
ケース4008:err="初期化されていない文字列";壊す;
ケース4009:err="配列内の初期化されていない文字列";壊す;
ケース4010:err="文字列配列のメモリ不足";壊す;
ケース4011:err="文字列が長すぎます";壊す;
ケース4012:err="残りゼロ";壊す;
ケース4013:err="ゼロ除算";壊す;
ケース4014:err="不明なコマンド";壊す;
ケース4015:err="不正な遷移";壊す;
ケース4016:err="初期化されていない配列";壊す;
ケース4017:err="DLL呼び出しは許可されていません";壊す;
ケース4018:err="ライブラリを読み込めません";壊す;
ケース4019:err="関数を呼び出せません";壊す;
ケース4020:err="外部ライブラリ関数の呼び出しは許可されていません";壊す;
ケース4021:err="関数から返される文字列に十分なメモリがありません";壊す;
ケース4022:err="システムビジー";壊す;
ケース4050:err="関数パラメーターの数が無効です";壊す;
ケース4051:err="無効な関数パラメーター値";壊す;
ケース4052:err="文字列関数の内部エラー";壊す;
ケース4053:err="配列エラー";壊す;
ケース4054:err="時系列配列の誤った使用";壊す;
ケース4055:err=" カスタムインジケータエラー";壊す;
ケース4056:err="アレイは互換性がありません";壊す;
ケース4057:err="グローバル変数の処理中にエラーが発生しました";壊す;
ケース4058:err="グローバル変数が見つかりません";壊す;
ケース4059:err="テストモードでは機能が許可されていません";壊す;
ケース4060:err="関数は許可されていません";壊す;
ケース4061:err="メール送信エラー";壊す;
ケース4062:err="文字列パラメータが必要です";壊す;
ケース4063:err="整数パラメータが必要です";壊す;
ケース4064:err = "double expected";壊す;
ケース4065:err="配列はパラメータとして必要です";壊す;
ケース4066:err="更新状態の要求された履歴データ";壊す;
ケース4067:err="トレード操作の実行中にエラーが発生しました";壊す;
ケース4099:err="ファイルの終わり";壊す;
ケース4100:err="ファイルの操作中にエラーが発生しました";壊す;
ケース4101:err="無効なファイル名";壊す;
ケース4102:err="開いているファイルが多すぎます";壊す;
ケース4103:err="ファイルを開くことができません";壊す;
ケース4104:err="互換性のないファイルアクセスモード";壊す;
ケース4105:err="注文が選択されていません";壊す;
ケース4106:err="不明な文字";壊す;
ケース4107:err="取引関数の価格パラメーターが正しくありません";壊す;
ケース4108:err="無効なチケット番号";壊す;
ケース4109:err="取引は許可されていません。EAプロパティでEAの取引を許可するオプションを有効にする必要があります。";壊す;
ケース4110:err="ロングポジションは許可されていません。EAプロパティを確認する必要があります。";壊す;
ケース4111:err="短い位置は許可されていません。EAのプロパティを確認する必要があります。";壊す;
ケース4200:err="オブジェクトはすでに存在します";壊す;
ケース4201:err="不明なオブジェクトプロパティが要求されました";壊す;
ケース4202:err="オブジェクトが存在しません";壊す;
ケース4203:err="不明なオブジェクトタイプ";壊す;
ケース4204:err="オブジェクト名なし";壊す;
ケース4205:err="オブジェクト座標エラー";壊す;
ケース4206:err="指定されたサブウィンドウが見つかりませんでした";壊す;
デフォルト:err="オブジェクトの操作中にエラーが発生しました";
}
Alert( "end ErrorDescription");
return(err);
} // End ErrorDescription()
// ------------------------------------------------ -------------------------------------------------- ------------------------
// =============================================== = ================================================ == =======================
int GetNext(NextTick)
// >> >> >> >> >> >> >> >> >> >> >> >>
{{
Alert( "beg GetNext(NextTick)");
Alert(NextTick);
while(RefreshRates()== false)Count ++;
Alert( "Count ="、Count、 "NextTick ="、NextTick);
Alert( "");
Alert(RefreshRates()、Count、NextTick);
return(NextTick);
Alert(NextTick);
// -------------------
Alert( "end GetNext(NextTick)");
}
// GetNext(NextTick)を終了します
// =============================================== = ================================================ == =======================
// ------------------------------------------------ -------------------------------------------------- ------------------------
void OnTick()
{{
// ***********************************
Alert( "beg OnTick");
// ***********************************
FastMA = NormalizeDouble(iMA(NULL、0、Period_FastMA、0、MODE_SMA、PRICE_CLOSE、1)、Digits()); // Period_FastMA = 4
SlowMA = NormalizeDouble(iMA(NULL、0、Period_SlowMA、0、MODE_SMA、PRICE_CLOSE、1)、Digits()); // Period_SlowMA = 8
GetNext(NextTick);
Alert( "NextTick ="、NextTick);
Delta = NormalizeDouble(FastMA-SlowMA、Digits()); Alert( "beg OnTick");
Alert(Delta、Digits());
Alert( "FastMA ="、DoubleToStr(FastMA、Digits())、 "SlowMA ="、DoubleToStr(SlowMA、Digits())、 "Delta ="、DoubleToStr(Delta、Digits()));
Alert( "end OnTick");
// ------------------------------------------------ -------------------------------------------------- --------------------------
} // end(end OnTick)
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<
// ------------------------------------------------ -------------------------------------------------- ----------------------------
// =============================================== = ================================================ == ==========================
void Init()
{{
Alert( "");
Alert( "beg Init()");
Alert( "");
StringBeg = StringConcatenate( "TimeToStr(TIME_DATE、TIME_SECONDS)="、TimeToStr(TIME_DATE、TIME_SECONDS));
alert(stringbeg);
record = StringConcatenate( "MaxTickNum ="、MaxTickNum);
alert(record);
record = StringConcatenate( "k_SL ="、DoubleToStr(k_SL、Digits()));
alert(record);
record = StringConcatenate( "k_TP ="、DoubleToStr(k_TP、Digits()));
alert(record);
record = StringConcatenate( "k_lots ="、DoubleToStr(k_lots、Digits()));
alert(record);
Alert( "end Init()");
} // end Init()
// ------------------------------------------------ -------------------------------------------------- ------------------------
// =============================================== = ================================================ == ====================
int GetTick(NextTick)
{{
Alert( "beg GetTick");
while(RefreshRates()== false)
NextTick ++;
Alert( "NextTick ="、NextTick);
OrderSelect(NextTick、SELECT_BY_TICKET);
Profit = OrderProfit();
Alert(DoubleToStr(Profit、Digits));
GetNext(NextTick);
Alert( "end GetTick");
}
// ------------------------------------------------ -------------------------------------------------- -------------------------------------------------- --------
// =============================================== = ================================================ == =========================
int NextType()
//>>>>>>>>>>>>>>>>>>>>>>>
{{
Alert( "beg NextType");
if(OrderSelect(NextTick、SELECT_BY_TICKET)== true)
{{
OpenPrice = OrderOpenPrice();
ClosePrice = OrderClosePrice();
}
if(ClosePrice> OpenPrice)CurType = OP_BUY;
それ以外の場合、CurType = OP_SELL;
return(curType);
Alert( "end CurType()");
//>>>>>>>>>>>>>>>>>>>>>>>>>>>
} // "end CurType()";
// ------------------------------------------------ -------------------------------------------------- ----------------------------
// =============================================== = ================================================ == ===========================
bool FastMACrossUp()
{{
if(!(Delta == LastDelta))Alert( "Delta ="、DoubleToStr(Delta、5)、 "LastDelta ="、DoubleToStr(LastDelta、5));
Alert( "LastDelta ="、DoubleToStr(LastDelta、5));
Alert( "!(Delta == LastDelta)="、!(Delta == LastDelta));
if(((Delta!= LastDelta)&&(Delta> = 0)&&(LastDelta <= 0)))Alert( "(Delta!= LastDelta)&&(Delta> = 0)&&(LastDelta <= 0)=" 、
(Delta!= LastDelta)&&(Delta> = 0)&&(LastDelta <= 0));
Alert( "(Delta> = 0)="、(Delta> = 0)、 "(LastDelta <= 0)="、(LastDelta <= 0));
if(Delta!= LastDelta)Alert( "Delta ="、DoubleToStr(Delta、5)、 "LastDelta ="、DoubleToStr(LastDelta、5));
Alert( "(Delta> = 0)="、(Delta> = 0)、 "(LastDelta <= 0)="、(LastDelta <= 0)、 "TickNum ="、TickNum);
Alert( "(Delta> = 0)="、(Delta> = 0));
Alert( "LastDelta <="、(LastDelta <= 0));
Alert( "!(Delta == LastDelta)&&((Delta> = 0)&&(LastDelta <= 0))="、!(Delta == LastDelta)&&((Delta> = 0)&&(LastDelta <= 0 )));
Alert(((Delta!= LastDelta)&&((Delta> = 0)&&(LastDelta <= 0))));
Alert( "(Delta!= LastDelta)="、(Delta!= LastDelta)、 "(Delta> = 0)="、(Delta> = 0)、 "(LastDelta <= 0)="、(LastDelta <= 0));
return((Delta!= LastDelta)&&(Delta> = 0)&&(LastDelta <= 0));
} // FastMACrossUp()を終了します
// ------------------------------------------------ -------------------------------------------------- --------------------
// =============================================== = ================================================ == ===================
bool FastMACrossDn()
{{
if(!(Delta == LastDelta)&&(Delta <= 0)&&(LastDelta> = 0))Alert( "Delta ="、DoubleToStr(Delta、5)、 "LastDelta ="、DoubleToStr(LastDelta、5)) ;
Alert( "LastDelta ="、DoubleToStr(LastDelta、5));
Alert( "!(Delta == LastDelta)="、!(Delta == LastDelta));
Alert( "(Delta <= 0)="、(Delta <= 0));
Alert( "LastDelta> = 0"、(LastDelta> = 0));
if((Delta!= LastDelta)&&(Delta <= 0)&&(LastDelta> = 0))
Alert( "(Delta <= 0)="、(Delta <= 0)、 "(LastDelta> = 0)="、(LastDelta> = 0));
Alert( "(Delta!= LastDelta)&&((Delta <= 0)&&(LastDelta> = 0))="、(Delta!= LastDelta)&&(Delta <= 0)&&(LastDelta> = 0));
if(Delta!= LastDelta)Alert( "Delta ="、DoubleToStr(Delta、5)、 "LastDelta ="、DoubleToStr(LastDelta、5));
Alert( "(Delta <= 0)="、(Delta <= 0)、 "(LastDelta> = 0)="、(LastDelta> = 0)、 "TickNum ="、TickNum);
Alert( "(Delta!= LastDelta)&&((Delta <= 0)&&(LastDelta> = 0))="、(Delta!= LastDelta)&&((Delta <= 0)&&(LastDelta> = 0)) );
return((Delta!= LastDelta)&&(Delta <= 0)&&(LastDelta> = 0));
} // end FastMACrossDn()
// ------------------------------------------------ -------------------------------------------------- --------------------------------------
// =============================================== = ================================================ == ==================================
bool FastMAIsAbove()
{{
Alert( "beg FastMAIsAbove()");
Alert( "(Delta> = 0)="、(Delta> = 0)、 "(LastDelta> = 0)="、(LastDelta> = 0));
if(((Delta> = 0)&&(LastDelta> = 0)))
Alert( "FastMA ="、DoubleToStr(FastMA、5)、 "SlowMA ="、DoubleToStr(SlowMA、5));
Alert( "Delta ="、DoubleToStr(Delta、5)、 "LastDelta ="、DoubleToStr(LastDelta、5));
Alert( "end FastMAIsAbove()");
Alert( "(Delta == LastDelta)&&(Delta> = 0)&&(LastDelta> = 0)="、(Delta == LastDelta)&&(Delta> = 0)&&(LastDelta> = 0));
Alert( "end FastMAIsAbove()");
return((Delta == LastDelta)&&(Delta> = 0)&&(LastDelta> = 0));
} // end FastMAIsAbove()
// =============================================== = ================================================ == ================
// ------------------------------------------------ -------------------------------------------------- ------------------
bool FastMAIsBelow()
{{
return((Delta == LastDelta)&&(Delta <= 0)&&(LastDelta <= 0));
} // end FastMAIsBelow()* /
「」
// ------------------------------------------------ -------------------------------------------------- ------------------
// ************************************************ ** *****************************************
「」
Initはどのような方法でも開始することはできず、DeInitと同様にインジケータ/エキスパートが起動したときに一度だけ自動的に開始されます。
また、静的なブーリアン変数を作り、IsConnected() と共に使用することもできます。そして、新しいティックの到着で接続を回復するとき、最初は独自の初期化関数を起動する必要があります。しかし、IsConnected() はOnCalculate()の中ではなく、OnTimer()の中で使うべきで、私独自の初期化関数はOnCalculate()の一番最初の部分で使うべきです。
ありがとうございます!考えてみます!ただ、すでに典型的な解決策があるのでは......と思ってしまいました。
全てのコード
ありがとうございます。考えてみます。ただ、典型的な解決策がすでにあるのではと思いました......。
この方の言葉には、すでに反論を書かせていただきました。OnItit()は普通の関数です。必要なときに実行する。
全てのコード
SRCボタンを使ってコードを添付してください。すみません、完全に学習能力がないのでしょうか?
誰がこんなガラクタを見たいと思うのか、教えてください。
この人の言葉に対する反論は、すでに書いている。OnItit()は通常の関数です。必要なときに実行すればよい。
そうですね、そうですね、接続するときにかければいいんじゃないかと。できることがわかりました :-)
全てのコード
可変型に注意
不要なAlertはすべて捨てる