jforex SDKで価格の桁の扱い方、pip との変換について。
例えば、EURUSDとUSDJPY をみると、
EURUSD : 1.12321 (1pip は0.0001)
USDJPY : 110.783 (1pip は0.01)
のように、桁が違っているので気を付ける必要がある。
また、通貨ペアごとに価格に対する1pip の桁も変わってくる。
■ jforex に用意されているメソッド
instrument.getPipScale() : 1pip が通貨ペアの価格で小数点以下の何番目か
instrument.getPipValue() : 1pip が対応する通貨ペアの価格の値
(日本語が変だw)
■getPipScale()
(例:EURUSDだと 4を返す。 EURUSD の場合少数以下の4桁目が1pip に相当)
プログラム内で通貨ペアの価格はdouble なので、注文を出したり、チャート上に表示する場合には何らかの端数処理をしてから利用する必要がある。
コードサンプル (Rounding prices)
https://www.dukascopy.com/wiki/en/development/strategy-api/practices/rounding-prices
ここでの例では、以下のようにして利用している。
round(amount, instrument.getPipScale() + 1);
jforex の場合、0.1pip まで有効なのでプラス1してる。
■ getPipValue()
例えば注文時に、10pips のtp (takeprofit), sl (stoploss) の指定をする場合、
10 x instrument.getPipValue()
で通貨ペアの価格差に変換できる。
■ EURUSD の価格が1.23456 の場合を考えてみる
getPipScale() -> 4
EURUSD の1pip は下4桁の個所 -> 1.23456
price (double型) が1.23456789... となっていたら、0.1pip までの
1.23456 を利用したい
round(price, getPipScale() + 1)
getPipValue() -> 1.0e-4
tp = currentPrice + 10 x getPipValue() # 現在値から10pip 上
sl = currentPrice - 10 x getPipValue() # 現在値から10pip下
うまく説明できたかな? できてないですよね。日本語が変.....
luckyyniki, play casino game online - CasinoinJapan
返信削除Luckyyniki, play casino game online at CasinoinJapan! ラッキーニッキー We are not affiliated with any major casino, casino, poker, table games, casino クイーンカジノ games, fun88 vin
It’s not an app we’re speaking about – it’s the web-based model, and it’s equally good on each desktop computers and smartphones. Thanks to this promotion, players can obtain a proportion of their net losses again as cash. This supply 네온카지노 is a standard Deposit Bonus, which provides extra funds or a handful of free spins on a qualifying deposit. Grand Vegas video poker offers you the possibility to play single hand, three palms, ten palms, or absolutely fifty-two hands! Online gamblers may not understand they have a problem outcome of|as a result of} it’s not disrupting their lives in terms of|when it comes to|by means of} work and social activities. Friends and members of the family may not even bear in mind that their liked one gambles, and subsequently can’t assist them stop.
返信削除