MT4で現値の下に買いの指値を入れたい…


最近、トレード手法の検証のためにMetaTrader4を入れていじり始めた。バックテストで長期間試験したいのに出来なくて困っていたけど、やっとできたからプログラムを書き始めた。
が…….
現値の上に買いの指値(買いの逆指値)は入れられたけど、現値の下に買いの指値をいれると「Invalid stops」といわれてオーダーが通らないんだよなぁ。なんでだろう
ちなみにこんな感じで書いてみた。
ticket = OrderSend(Symbol(), OP_BUYLIMIT, lotsize, entry_price, 0, 0, close_price, “”, 4, 0, Red);
何が悪いんだろうねぇ。上の場合はstop levelを0にしてあるけど、現値×80%とかしてもダメ。なので0を指定しちゃいかんというわけじゃないと思う。
自己フォロー(^^;
StopLoss and TakeProfit levels cannot be too close to the market. The minimal distance of stop levels in points can be obtained using the MarketInfo() function with MODE_STOPLEVEL parameter. In the case of erroneous or unnormalized stop levels, the error 130 (ERR_INVALID_STOPS) will be generated.
At placing of a pending order, the open price cannot be too close to the market. The minimal distance of the pending price from the current market one in points can be obtained using the MarketInfo() function with the MODE_STOPLEVEL parameter. In case of false open price of a pending order, the error 130 (ERR_INVALID_STOPS) will be generated.
指値が現値に近すぎるとこのエラーが出るらしい。どれくらい離したらいいかはMarketInfo()関数にMODE_STOPLEVELパラメータを与えて調べろ。
むー。USDJPYで5pointsだなぁ。もちろん、Askより20points下(スプレッドが2,3pointsだから充分)にして5pointsよりももっと下にopen priceを指示してある。わけがわかりませんなぁ(T_T)

シェアする

  • このエントリーをはてなブックマークに追加

フォローする

コメント

  1. koj より:

    tomaさん
    ヨットもいいですなぁ。何がいいって静かなのがいいってボート講習の先生が言ってました。