//+------------------------------------------------------------------+//| OnTick function |//+------------------------------------------------------------------+voidOnTick(){
staticdatetime timeCur; datetime timePre = timeCur; timeCur=Time[0];
bool isNewBar = timeCur != timePre;
if(isNewBar){
return; // Once per bar
}
return; // every tick
}
新しいバーであれば戻り、そうでなければ戻るので、いつも何もせずに戻ってきます。
新しいバーが見つかったら、値をリセットする必要があります。
voidOnTick(){
datetime timeCur=Time[0];
staticdatetime timePre = timeCur;
bool isNewBar = timeCur != timePre;
if(isNewBar){
timePre=timeCur;
//Do what you want at each new bar // Once per bar
}
//Do other stuff that you may need to do every tickreturn; // every tick
}
OK 私はコードを適用しました...しかし、私はそれぞれの新しいバーで開始関数を 呼び出そうとしたとき...それはどんな注文も取りません...。
voidOnTick(){
datetime timeCur=Time[0];
staticdatetime timePre = timeCur;
bool isNewBar = timeCur != timePre;
if(isNewBar){
timePre=timeCur;
//Do what you want at each new bar // Once per bar
start();
}
//Do other stuff that you may need to do every tickreturn; // every tick
}
さらに、ストップした注文のリバーストレードも機能しない。
これは信頼性が低いということはすでに言われていることですが
これは何もしません
新しいバーであれば戻り、そうでなければ戻るので、いつも何もせずに戻ってきます。
新しいバーが見つかったら、値をリセットする必要があります。
最後の注文をチェック するコードでは、注文履歴の中で最も高いインデックスが最新の決済済み取引であると仮定しています。これが常に正しいかどうかはわかりません。
OK 私はコードを適用しました...しかし、私はそれぞれの新しいバーで開始関数を 呼び出そうとしたとき...それはどんな注文も取りません...。
たとえ私が新しいバーゾーンの中にbuyCallとsellcall関数を追加しても、そしてティックゾーンの中にstart()...その複数の注文を作成します。
このstart関数と一緒に、main関数で呼ばれる以下のような追加関数があります。
int split(double x)
void BuyCall(double BC)
void SellCall(double SC)
そして最後に void onTick 関数ですが、これはどう設定すればよいのでしょうか。
...各時間に保留中の注文のシーケンスを1つだけ...さらに、保留中の注文が停止された場合、それをチェックします。
...そして、それは反対方向に別の取引を開始します...しかし、1時間に1つのシーケンスだけ。
何度も何度も同じところで立ち往生しているのですが、明らかに学びたいのです。
...私のコンセプトをクリアしたいのですが...:(
お時間をいただきありがとうございました。