PINE LIBRARY
Atualizado FO_Util

Library "FO_Util"
f_inSession(startHour, startMinute, endHour, endMinute)
Parameters:
startHour (int)
startMinute (int)
endHour (int)
endMinute (int)
f_isExecutionBlocked(marketType)
Parameters:
marketType (string)
f_allowEntry(useSessionFilter, startHour, startMinute, endHour, endMinute, marketType)
Parameters:
useSessionFilter (bool)
startHour (int)
startMinute (int)
endHour (int)
endMinute (int)
marketType (string)
f_volFilter(_volume, volMA, volMultiplier)
Parameters:
_volume (float)
volMA (float)
volMultiplier (float)
f_wickCondition(_open, _close, _high, _low, _ratio, _wickSide)
Parameters:
_open (float)
_close (float)
_high (float)
_low (float)
_ratio (float)
_wickSide (int)
f_atrRangeFilter(_high, _low, _atr, _mult)
Parameters:
_high (float)
_low (float)
_atr (float)
_mult (float)
f_updatePositionExtremes(inLong, inShort, prevHigh, prevLow, highestPrev, lowestPrev)
Parameters:
inLong (bool)
inShort (bool)
prevHigh (float)
prevLow (float)
highestPrev (float)
lowestPrev (float)
f_calcATRExitLevels(avgPrice, atr, atrStopMult, atrLimitMult)
Parameters:
avgPrice (float)
atr (float)
atrStopMult (float)
atrLimitMult (float)
f_calcATRTrailStop(avgPrice, highestPrev, lowestPrev, atrPrev, trailAtrMult, atrLimitMult, atrStopMult, inLong, inShort)
Parameters:
avgPrice (float)
highestPrev (float)
lowestPrev (float)
atrPrev (float)
trailAtrMult (float)
atrLimitMult (float)
atrStopMult (float)
inLong (bool)
inShort (bool)
f_calcATRExit(avgPrice, atr, highestPrev, lowestPrev, prevHigh, prevLow, trailAtrMult, atrStopMult, atrLimitMult, inLong, inShort)
Parameters:
avgPrice (float)
atr (float)
highestPrev (float)
lowestPrev (float)
prevHigh (float)
prevLow (float)
trailAtrMult (float)
atrStopMult (float)
atrLimitMult (float)
inLong (bool)
inShort (bool)
f_executeEntry(longSignal, shortSignal)
Parameters:
longSignal (bool)
shortSignal (bool)
f_isPreClose(closeHour, closeMinute)
Parameters:
closeHour (int)
closeMinute (int)
f_executeSessionClose(useSessionClose, closeHour, closeMinute)
Parameters:
useSessionClose (bool)
closeHour (int)
closeMinute (int)
f_inSession(startHour, startMinute, endHour, endMinute)
Parameters:
startHour (int)
startMinute (int)
endHour (int)
endMinute (int)
f_isExecutionBlocked(marketType)
Parameters:
marketType (string)
f_allowEntry(useSessionFilter, startHour, startMinute, endHour, endMinute, marketType)
Parameters:
useSessionFilter (bool)
startHour (int)
startMinute (int)
endHour (int)
endMinute (int)
marketType (string)
f_volFilter(_volume, volMA, volMultiplier)
Parameters:
_volume (float)
volMA (float)
volMultiplier (float)
f_wickCondition(_open, _close, _high, _low, _ratio, _wickSide)
Parameters:
_open (float)
_close (float)
_high (float)
_low (float)
_ratio (float)
_wickSide (int)
f_atrRangeFilter(_high, _low, _atr, _mult)
Parameters:
_high (float)
_low (float)
_atr (float)
_mult (float)
f_updatePositionExtremes(inLong, inShort, prevHigh, prevLow, highestPrev, lowestPrev)
Parameters:
inLong (bool)
inShort (bool)
prevHigh (float)
prevLow (float)
highestPrev (float)
lowestPrev (float)
f_calcATRExitLevels(avgPrice, atr, atrStopMult, atrLimitMult)
Parameters:
avgPrice (float)
atr (float)
atrStopMult (float)
atrLimitMult (float)
f_calcATRTrailStop(avgPrice, highestPrev, lowestPrev, atrPrev, trailAtrMult, atrLimitMult, atrStopMult, inLong, inShort)
Parameters:
avgPrice (float)
highestPrev (float)
lowestPrev (float)
atrPrev (float)
trailAtrMult (float)
atrLimitMult (float)
atrStopMult (float)
inLong (bool)
inShort (bool)
f_calcATRExit(avgPrice, atr, highestPrev, lowestPrev, prevHigh, prevLow, trailAtrMult, atrStopMult, atrLimitMult, inLong, inShort)
Parameters:
avgPrice (float)
atr (float)
highestPrev (float)
lowestPrev (float)
prevHigh (float)
prevLow (float)
trailAtrMult (float)
atrStopMult (float)
atrLimitMult (float)
inLong (bool)
inShort (bool)
f_executeEntry(longSignal, shortSignal)
Parameters:
longSignal (bool)
shortSignal (bool)
f_isPreClose(closeHour, closeMinute)
Parameters:
closeHour (int)
closeMinute (int)
f_executeSessionClose(useSessionClose, closeHour, closeMinute)
Parameters:
useSessionClose (bool)
closeHour (int)
closeMinute (int)
Notas de Lançamento
v2追加:
f_slopeFilter(src, length, threshold, normBase)
Parameters:
src (float)
length (int)
threshold (float)
normBase (float)
Notas de Lançamento
v3更新:
f_volFilter(_volume, volMA, volMultiplier, mode)
Parameters:
_volume (float)
volMA (float)
volMultiplier (float)
mode (string)
f_atrRangeFilter(_high, _low, _atr, _mult, mode)
Parameters:
_high (float)
_low (float)
_atr (float)
_mult (float)
mode (string)
Notas de Lançamento
v4追加:
f_isNearPriceLimit(currentPrice, prevDayClose, limitPerc)
Parameters:
currentPrice (float)
prevDayClose (float)
limitPerc (float)
更新:
f_isExecutionBlocked(marketType, prevDayClose, limitPerc)
Parameters:
marketType (string)
prevDayClose (float)
limitPerc (float)
Notas de Lançamento
v5Notas de Lançamento
v6更新:
f_allowEntry(useSessionFilter, startHour, startMinute, endHour, endMinute, marketType, prevDayClose, limitPerc)
Parameters:
useSessionFilter (bool)
startHour (int)
startMinute (int)
endHour (int)
endMinute (int)
marketType (string)
prevDayClose (float)
limitPerc (float)
f_calcATRExit(avgPrice, atr, highestPrev, lowestPrev, prevHigh, prevLow, trailAtrMult, atrStopMult, atrLimitMult, inLong, inShort, prevDayClose, exitLimitPerc)
Parameters:
avgPrice (float)
atr (float)
highestPrev (float)
lowestPrev (float)
prevHigh (float)
prevLow (float)
trailAtrMult (float)
atrStopMult (float)
atrLimitMult (float)
inLong (bool)
inShort (bool)
prevDayClose (float)
exitLimitPerc (float)
Notas de Lançamento
v7追加:
f_getPrevDayClose()
Notas de Lançamento
v8Notas de Lançamento
v9更新:
f_calcATRExit(avgPrice, atr, highestPrev, lowestPrev, prevHigh, prevLow, trailAtrMult, atrStopMult, atrLimitMult, inLong, inShort, prevDayClose, exitLimitPerc, maxStopPerc)
Parameters:
avgPrice (float)
atr (float)
highestPrev (float)
lowestPrev (float)
prevHigh (float)
prevLow (float)
trailAtrMult (float)
atrStopMult (float)
atrLimitMult (float)
inLong (bool)
inShort (bool)
prevDayClose (float)
exitLimitPerc (float)
maxStopPerc (float)
Notas de Lançamento
v10更新:
f_calcATRExit(avgPrice, atr, highestPrev, lowestPrev, prevHigh, prevLow, trailAtrMult, atrStopMult, atrLimitMult, inLong, inShort, maxStopPerc, prevDayClose, exitLimitPerc)
Parameters:
avgPrice (float)
atr (float)
highestPrev (float)
lowestPrev (float)
prevHigh (float)
prevLow (float)
trailAtrMult (float)
atrStopMult (float)
atrLimitMult (float)
inLong (bool)
inShort (bool)
maxStopPerc (float)
prevDayClose (float)
exitLimitPerc (float)
Notas de Lançamento
v11Notas de Lançamento
v12追加:
f_getPrevDayHighLow()
Notas de Lançamento
v13追加:
f_getPrevDayOHLC()
削除:
f_getPrevDayClose()
f_getPrevDayHighLow()
Notas de Lançamento
v14更新:
f_executeSessionClose(useSessionClose, closeHour, closeMinute, marketType, useWeekendClose)
Parameters:
useSessionClose (bool)
closeHour (int)
closeMinute (int)
marketType (string)
useWeekendClose (bool)
Notas de Lançamento
v15追加:
f_getStopWidth(basePrice)
日本市場の個別株ルールに基づき、基準価格から制限値幅を算出します。
/ param basePrice 基準となる価格(前日終値など)
/ Returns float: 制限値幅(ストップ幅)
Parameters:
basePrice (float)
更新:
f_inSession(startHour, startMinute, endHour, endMinute)
指定した時間帯に現在時刻が含まれているかを判定します。日付またぎに対応。
/ param startHour 開始時刻(時)
/ param startMinute 開始時刻(分)
/ param endHour 終了時刻(時)
/ param endMinute 終了時刻(分)
/ Returns boolean: セッション内であれば true
Parameters:
startHour (int)
startMinute (int)
endHour (int)
endMinute (int)
f_isNearPriceLimit(currentPrice, prevDayClose, limitPerc)
現在値がストップ高・安付近(制限値幅の境界付近)にいるか判定します。
/ param currentPrice 現在の価格
/ param prevDayClose 前日終値
/ param limitPerc 境界から何%の範囲を「接近」とみなすか(0.5 = 制限幅の0.5%手前)
/ Returns boolean: 制限値幅付近であれば true
Parameters:
currentPrice (float)
prevDayClose (float)
limitPerc (float)
f_isExecutionBlocked(marketType, prevDayClose, limitPerc)
市場タイプ(株・先物)に応じた発注禁止時間を判定します。
/ param marketType "JP_STOCK" または "JP_FUT"
/ param prevDayClose 制限値幅判定用の前日終値
/ param limitPerc 制限値幅フィルターの感度
/ Returns boolean: 発注が禁止されるべき時間帯・状態なら true
Parameters:
marketType (string)
prevDayClose (float)
limitPerc (float)
f_allowEntry(useSessionFilter, startHour, startMinute, endHour, endMinute, marketType, prevDayClose, limitPerc)
セッション制御と発注禁止判定を統合したエントリー許可判定。
Parameters:
useSessionFilter (bool)
startHour (int)
startMinute (int)
endHour (int)
endMinute (int)
marketType (string)
prevDayClose (float)
limitPerc (float)
f_volFilter(_volume, volMA, volMultiplier, mode)
出来高の移動平均に対する閾値フィルター。
Parameters:
_volume (float)
volMA (float)
volMultiplier (float)
mode (string)
f_atrRangeFilter(_high, _low, _atr, _mult, mode)
ATRを用いたローソク足レンジ(High-Low)のフィルター。
Parameters:
_high (float)
_low (float)
_atr (float)
_mult (float)
mode (string)
f_wickCondition(_open, _close, _high, _low, _ratio, _wickSide)
ローソク足のヒゲ割合が指定値を超えているか判定します。
Parameters:
_open (float)
_close (float)
_high (float)
_low (float)
_ratio (float)
_wickSide (int)
f_slopeFilter(src, length, threshold, normBase)
指標の傾きを計算し、トレンド状態を返します。
/ Returns [slope, normalizedSlope, isRange, trendUp, trendDown]
Parameters:
src (float)
length (int)
threshold (float)
normBase (float)
f_updatePositionExtremes(inLong, inShort, prevHigh, prevLow, highestPrev, lowestPrev)
ポジション保有中の最高値・最安値を更新・保持します。
/ Returns [highestPrice, lowestPrice]
Parameters:
inLong (bool)
inShort (bool)
prevHigh (float)
prevLow (float)
highestPrev (float)
lowestPrev (float)
f_getPrevDayOHLC()
イントラデイにおいて前日のOHLCを取得します。
/ Returns [prevOpen, prevHigh, prevLow, prevClose]
f_calcATRExitLevels(avgPrice, atr, atrStopMult, atrLimitMult)
ATRベースの固定損切り・利確価格を算出します。
/ Returns [longStop, shortStop, longTP, shortTP]
Parameters:
avgPrice (float)
atr (float)
atrStopMult (float)
atrLimitMult (float)
f_calcATRTrailStop(avgPrice, highestPrev, lowestPrev, atrPrev, trailAtrMult, atrLimitMult, atrStopMult, inLong, inShort)
ATRベースのトレーリングストップ価格を算出します。
Parameters:
avgPrice (float)
highestPrev (float)
lowestPrev (float)
atrPrev (float)
trailAtrMult (float)
atrLimitMult (float)
atrStopMult (float)
inLong (bool)
inShort (bool)
f_calcATRExit(avgPrice, atr, highestPrev, lowestPrev, prevHigh, prevLow, trailAtrMult, atrStopMult, atrLimitMult, inLong, inShort, maxStopPerc, exitLimitPerc, prevDayClose)
固定TP/SL、トレーリング、制限値幅ガードを統合した最終決済価格を算出します。
/ Returns [longStop, shortStop, longLimit, shortLimit, hNext, lNext]
Parameters:
avgPrice (float)
atr (float)
highestPrev (float)
lowestPrev (float)
prevHigh (float)
prevLow (float)
trailAtrMult (float)
atrStopMult (float)
atrLimitMult (float)
inLong (bool)
inShort (bool)
maxStopPerc (float)
exitLimitPerc (float)
prevDayClose (float)
f_executeEntry(longSignal, shortSignal, longId, shortId)
ストラテジーのエントリーを実行します(ドテン対応)。
Parameters:
longSignal (bool)
shortSignal (bool)
longId (string)
shortId (string)
f_isPreClose(closeHour, closeMinute)
特定の時刻が引け間際であるかを判定します。
Parameters:
closeHour (int)
closeMinute (int)
f_executeSessionClose(useSessionClose, closeHour, closeMinute, marketType, useWeekendClose)
セッション終了時および週末の強制決済を実行します。
Parameters:
useSessionClose (bool)
closeHour (int)
closeMinute (int)
marketType (string)
useWeekendClose (bool)
Notas de Lançamento
v17追加:
f_dailyArray(length)
5分足などのイントラデイチャートにおいて、日足のOHLCを配列で管理・更新します。
/ param length 保持する日足の最大日数
/ Returns [float[] highs, float[] lows, float[] closes, bool isNewDay]
Parameters:
length (int)
f_calcChopFromArrays(hArr, lArr, cArr, length)
任意の高値・安値・終値配列からチョピネス・インデックスを算出します。
/ param hArr 高値配列
/ param lArr 安値配列
/ param cArr 終値配列
/ param length 計算期間
/ Returns float: チョピネス・インデックス (0-100)
Parameters:
hArr (array<float>)
lArr (array<float>)
cArr (array<float>)
length (int)
f_chopFilter(length, thresh)
内部で日足配列を取得し、チョピネス指標に基づき稼働可否を判定します。
/ param length チョピネスの計算期間(デフォルト14)
/ param thresh ヨコヨコとみなす閾値(この値以上で allowTrade が false)
/ Returns [chopVal, allowTrade]
Parameters:
length (int)
thresh (float)
Notas de Lançamento
v18更新:
f_adxFilter(diLen, adxThresh, adxSmooth)
ADXの期間、平滑化、閾値を指定してトレンド強度を判定します。
/ param diLen DIの計算期間(0 の場合はフィルター無効)
/ param adxThresh トレンド判定の閾値
/ param adxSmooth ADXの平滑化期間(na の場合は diLen と同じ値を使用)
/ Returns [adxValue, isStrongTrend]
Parameters:
diLen (simple int)
adxThresh (int)
adxSmooth (simple int)
Notas de Lançamento
v20更新:
f_adxFilter(diLen, adxThresh, mode, adxSmooth)
ADXの期間、閾値、判定モードを指定してトレンド強度を判定します。
/ param diLen DIの計算期間(0 の場合はフィルター無効)
/ param adxThresh トレンド判定の閾値
/ param mode 判定モード ("above": 閾値以上, "below": 閾値未満)
/ param adxSmooth ADXの平滑化期間(na の場合は diLen と同じ値を使用)
/ Returns [adxValue, isTrend]
Parameters:
diLen (simple int)
adxThresh (int)
mode (string)
adxSmooth (simple int)
f_chopFilter(length, thresh, mode)
内部で日足配列を取得し、チョピネス指標に基づき稼働可否を判定します。
/ param length チョピネスの計算期間(0 の場合はフィルター無効)
/ param thresh 判定の閾値
/ param mode 判定モード ("below": 閾値未満でTrue, "above": 閾値以上でTrue)
/ Returns [chopVal, allowTrade]
Parameters:
length (int)
thresh (float)
mode (string)
Notas de Lançamento
v21追加:
f_wickFilter(ratio, side, lookback)
指定期間内にヒゲ条件を満たした足があるか判定します
/ param lookback 遡るバーの数(1 なら現在の足のみ)
Parameters:
ratio (float)
side (int)
lookback (int)
Notas de Lançamento
v22追加:
f_volumeFilter(length, multiplier, mode)
出来高の移動平均に基づき、現在の出来高が閾値を超えているか判定します。
/ param length 平均計算期間(0 の場合はフィルター無効で常に true)
/ param multiplier 平均に対する倍率
/ param mode 判定モード ("above": 閾値以上でTrue, "below": 閾値未満でTrue)
Parameters:
length (int)
multiplier (float)
mode (string)
削除:
f_volFilter(_volume, volMA, volMultiplier, mode)
出来高の移動平均に対する閾値フィルター。
Notas de Lançamento
v23更新:
f_volumeFilter(length, multiplier, lookback, mode)
出来高の移動平均に基づき、現在の出来高が閾値を超えているか判定します。
/ param length 平均計算期間(0 の場合はフィルター無効で常に true)
/ param multiplier 平均に対する倍率
/ param lookback 遡るバーの数
/ param mode 判定モード ("above": 閾値以上でTrue, "below": 閾値未満でTrue)
Parameters:
length (int)
multiplier (float)
lookback (int)
mode (string)
Notas de Lançamento
v24Notas de Lançamento
v25Notas de Lançamento
v26更新:
f_slopeFilter(src, length, threshold, normBase)
指標の傾きを計算し、トレンド状態を返します。
/ param src 傾きを計算する対象(MAやVWAPなど)
/ param length 計算期間(0 の場合はフィルター無効)
/ param threshold トレンド判定の閾値
/ param normBase 正規化の基準値(ATRなど)
/ Returns [slope, slopeNormalized, isRange, trendUp, trendDown]
Parameters:
src (float)
length (int)
threshold (float)
normBase (float)
Notas de Lançamento
v27Notas de Lançamento
v28追加:
f_dmiAdxFilter(diLen, useDmi, adxThresh, mode)
DMIとADXのフィルター判定を一括処理します(順張り・逆張りモード対応)。
/ param diLen 計算期間(0 の場合はDMI・ADXの両方を完全にパス/無効化)
/ param useDmi DMI方向フィルターを使うか(falseならDMIの方向制限をパス)
/ param adxThresh ADXの閾値(0 の場合はADXフィルターをパス/無効化)
/ param mode ADXの判定モード ("above": 閾値以上でパス, "below": 閾値未満でパス)
/ Returns [dmiLong, dmiShort, adxOK]
Parameters:
diLen (simple int)
useDmi (bool)
adxThresh (int)
mode (string)
削除:
f_adxFilter(diLen, adxThresh, mode, adxSmooth)
ADXの期間、閾値、判定モードを指定してトレンド強度を判定します。
/ param diLen DIの計算期間(0 の場合はフィルター無効)
/ param adxThresh トレンド判定の閾値
/ param mode 判定モード ("above": 閾値以上, "below": 閾値未満)
/ param adxSmooth ADXの平滑化期間(na の場合は diLen と同じ値を使用)
/ Returns [adxValue, isTrend]
Notas de Lançamento
v29更新:
f_atrRangeFilter(_high, _low, _atr, _mult, mode)
ATRを用いたローソク足レンジ(High-Low)のフィルター。
/ param _mult 倍率(0.0 の場合はフィルター無効で常に true を返す)
Parameters:
_high (float)
_low (float)
_atr (float)
_mult (float)
mode (string)
Notas de Lançamento
v30Notas de Lançamento
v31更新:
f_dmiAdxFilter(diLen, useDmi, adxThresh, mode)
DMIとADXのフィルター判定を一括処理します(順張り・逆張りモード自動対応)。
/ param diLen 計算期間(0 の場合はDMI・ADXの両方を完全にパス/無効化)
/ param useDmi DMI方向フィルターを使うか(falseならDMIの方向制限をパス)
/ param adxThresh ADXの閾値(0 の場合はADXフィルターをパス/無効化)
/ param mode ADXの判定モード ("above": 順張り/閾値以上でパス, "below": 逆張り/閾値未満でパス)
/ Returns [dmiLong, dmiShort, adxOK]
Parameters:
diLen (simple int)
useDmi (bool)
adxThresh (int)
mode (string)
Notas de Lançamento
v32Notas de Lançamento
v33Notas de Lançamento
v34Notas de Lançamento
v35更新:
f_allowEntry(useSessionFilter, startHour, startMinute, endHour, endMinute, marketType, prevDayClose, limitPerc, backtestDays)
セッション制御と発注禁止判定を統合したエントリー許可判定。
Parameters:
useSessionFilter (bool)
startHour (int)
startMinute (int)
endHour (int)
endMinute (int)
marketType (string)
prevDayClose (float)
limitPerc (float)
backtestDays (int)
Notas de Lançamento
v36更新:
f_allowEntry(useSessionFilter, startHour, startMinute, endHour, endMinute, marketType, backtestDays, limitPerc)
セッション制御と発注禁止判定を統合したエントリー許可判定。
Parameters:
useSessionFilter (bool)
startHour (int)
startMinute (int)
endHour (int)
endMinute (int)
marketType (string)
backtestDays (int)
limitPerc (float)
Notas de Lançamento
v37更新:
f_allowEntry(useSessionFilter, startHour, startMinute, endHour, endMinute, marketType, fromDays, toDays, limitPerc)
セッション制御と発注禁止判定を統合したエントリー許可判定。
Parameters:
useSessionFilter (bool)
startHour (int)
startMinute (int)
endHour (int)
endMinute (int)
marketType (string)
fromDays (int)
toDays (int)
limitPerc (float)
Notas de Lançamento
v38Notas de Lançamento
v39更新:
f_dmiAdxFilter(diLen, useDmi, adxThreshMin, adxThreshMax)
DMIとADXのフィルター判定を一括処理します。
/ param diLen 計算期間(0 の場合はDMI・ADXの両方を完全にパス)
/ param useDmi DMI方向フィルターを使うか
/ param adxThreshMin ADX下限値(0なら下限なし)
/ param adxThreshMax ADX上限値(0なら上限なし)
/ Returns [dmiLong, dmiShort, adxOK]
Parameters:
diLen (simple int)
useDmi (bool)
adxThreshMin (float)
adxThreshMax (float)
f_chopFilter(length, threshMin, threshMax)
内部で日足配列を取得し、チョピネス指標に基づき稼働可否を判定します。
/ param length チョピネスの計算期間(0 の場合はフィルター無効)
/ param threshMin 許可する最小チョピネス値(0なら下限なし)
/ param threshMax 許可する最大チョピネス値(0なら上限なし)
/ Returns [chopVal, allowTrade]
Parameters:
length (int)
threshMin (float)
threshMax (float)
Notas de Lançamento
v40更新:
f_volumeFilter(length, ratioMin, ratioMax, lookback)
出来高の移動平均比率に基づくフィルター。
/ param length 平均計算期間(0 の場合はフィルター無効)
/ param ratioMin 出来高比率の下限(0なら下限なし)
/ param ratioMax 出来高比率の上限(0なら上限なし)
/ param lookback 遡るバー数(期間内に1回でも条件を満たせばtrue)
/ Returns bool
Parameters:
length (int)
ratioMin (float)
ratioMax (float)
lookback (int)
f_atrRangeFilter(_high, _low, _atr, atrRatioMin, atrRatioMax)
ATRに対するローソク足レンジ比率のフィルター。
/ param _high 高値
/ param _low 安値
/ param _atr ATR値
/ param atrRatioMin ATR比率の下限(0なら下限なし)
/ param atrRatioMax ATR比率の上限(0なら上限なし)
/ Returns bool
Parameters:
_high (float)
_low (float)
_atr (float)
atrRatioMin (float)
atrRatioMax (float)
Notas de Lançamento
v42Notas de Lançamento
v43Notas de Lançamento
v44Notas de Lançamento
v45Notas de Lançamento
v46Notas de Lançamento
v47Notas de Lançamento
v48Notas de Lançamento
v49Notas de Lançamento
v50更新:
f_calcATRExitLevels(avgPrice, atr, atrStopMult, atrLimitMult)
ATRベースの固定損切り・利確価格を算出します。
/ Returns [longStop, shortStop, longLimit, shortLimit]
Parameters:
avgPrice (float)
atr (float)
atrStopMult (float)
atrLimitMult (float)
f_calcATRExit(avgPrice, atr, atrStopMult, atrLimitMult, exitLimitPerc, maxStopPerc)
固定TP/SL、制限値幅ガードを統合した決済価格を算出します。
Parameters:
avgPrice (float)
atr (float)
atrStopMult (float)
atrLimitMult (float)
exitLimitPerc (float)
maxStopPerc (float)
Notas de Lançamento
v51更新:
f_calcATRExit(avgPrice, atr, atrStopMult, atrLimitMult, maxStopPerc, priceLimitGuardPerc)
/ ATRベースの損切り・利確に加えて、リスク制御(最大損切り)と
/ 市場構造制限(ストップ高安付近の価格帯制限)を統合した最終決済価格を算出します。
/
/ Details
/ 本関数は以下の3階層でストップ・利確を構築します:
/
/ ① ATRベースロジック
/ - ボラティリティ(ATR)を基準とした動的な損切り・利確
/
/ ② 最大損切り制御(maxStopPerc)
/ - エントリー価格(basePrice)基準で最大損失幅を制限
/ - 急変動・想定外ギャップに対する保険的ストップ
/
/ ③ 価格制限ガード(priceLimitGuardPerc)
/ - 前日レンジ(ストップ高安相当)を基準とした価格帯制限
/ - 極端な価格帯での約定・利確/損切りを抑制
/
/ note
/ ・avgPrice が na または 0 の場合は close を代替基準とします
/ ・本関数は毎バー評価前提(strategy.exit 更新用途)
/ ・優先順位は ATR → maxStop → priceLimitGuard の順で適用されます
/
/ Returns
/ [longStop, shortStop, longLimit, shortLimit]
Parameters:
avgPrice (float)
atr (float)
atrStopMult (float)
atrLimitMult (float)
maxStopPerc (float)
priceLimitGuardPerc (float)
Notas de Lançamento
v52Notas de Lançamento
v53Notas de Lançamento
v54更新:
f_allowEntry(useSessionFilter, startHour, startMinute, endHour, endMinute, marketType, fromDate, toDate, limitPerc)
セッション制御と発注禁止判定を統合したエントリー許可判定。
Parameters:
useSessionFilter (bool)
startHour (int)
startMinute (int)
endHour (int)
endMinute (int)
marketType (string)
fromDate (int)
toDate (int)
limitPerc (float)
Biblioteca do Pine
Em verdadeiro espírito TradingView, o autor publicou este código Pine como uma biblioteca de código aberto para que outros programadores Pine da nossa comunidade possam reutilizá-lo. Parabéns ao autor! Você pode usar esta biblioteca de forma privada ou em outras publicações de código aberto, mas a reutilização deste código em publicações é regida pelas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Biblioteca do Pine
Em verdadeiro espírito TradingView, o autor publicou este código Pine como uma biblioteca de código aberto para que outros programadores Pine da nossa comunidade possam reutilizá-lo. Parabéns ao autor! Você pode usar esta biblioteca de forma privada ou em outras publicações de código aberto, mas a reutilização deste código em publicações é regida pelas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.