PINE LIBRARY
tradeEngine

Library "tradeEngine"
calculateLiquidationPrice(entryPrice, isLong, leverage, buffer)
Parameters:
entryPrice (float)
isLong (bool)
leverage (int)
buffer (float)
calculateTPLevels(entryPrice, atr, isLong, risk)
Parameters:
entryPrice (float)
atr (float)
isLong (bool)
risk (RiskConfig)
calculateSL(entryLow, entryHigh, isLong, risk)
Parameters:
entryLow (float)
entryHigh (float)
isLong (bool)
risk (RiskConfig)
simulateTrade(highs, lows, closes, entryIdx, entryPrice, entryLow, entryHigh, entryATR, isLong, risk, maxBars)
Parameters:
highs (array<float>)
lows (array<float>)
closes (array<float>)
entryIdx (int)
entryPrice (float)
entryLow (float)
entryHigh (float)
entryATR (float)
isLong (bool)
risk (RiskConfig)
maxBars (int)
createRiskConfig(leverage, liqBuffer, useTP1, tp1ATR, useTP2, tp2ATR, useSL, slBuffer, maker, taker, slip)
Parameters:
leverage (int)
liqBuffer (float)
useTP1 (bool)
tp1ATR (float)
useTP2 (bool)
tp2ATR (float)
useSL (bool)
slBuffer (float)
maker (float)
taker (float)
slip (float)
TradeResult
Fields:
exitType (series string)
exitBarIdx (series int)
exitPrice (series float)
finalPnL (series float)
maxPnL (series float)
tp1Hit (series bool)
tp2Hit (series bool)
slHit (series bool)
liquidated (series bool)
barsInTrade (series int)
tp1Level (series float)
tp2Level (series float)
slLevel (series float)
liqLevel (series float)
RiskConfig
Fields:
leverage (series int)
liquidationBuffer (series float)
useTP1 (series bool)
tp1ATR (series float)
useTP2 (series bool)
tp2ATR (series float)
useFixedSL (series bool)
slBuffer (series float)
makerFee (series float)
takerFee (series float)
slippage (series float)
calculateLiquidationPrice(entryPrice, isLong, leverage, buffer)
Parameters:
entryPrice (float)
isLong (bool)
leverage (int)
buffer (float)
calculateTPLevels(entryPrice, atr, isLong, risk)
Parameters:
entryPrice (float)
atr (float)
isLong (bool)
risk (RiskConfig)
calculateSL(entryLow, entryHigh, isLong, risk)
Parameters:
entryLow (float)
entryHigh (float)
isLong (bool)
risk (RiskConfig)
simulateTrade(highs, lows, closes, entryIdx, entryPrice, entryLow, entryHigh, entryATR, isLong, risk, maxBars)
Parameters:
highs (array<float>)
lows (array<float>)
closes (array<float>)
entryIdx (int)
entryPrice (float)
entryLow (float)
entryHigh (float)
entryATR (float)
isLong (bool)
risk (RiskConfig)
maxBars (int)
createRiskConfig(leverage, liqBuffer, useTP1, tp1ATR, useTP2, tp2ATR, useSL, slBuffer, maker, taker, slip)
Parameters:
leverage (int)
liqBuffer (float)
useTP1 (bool)
tp1ATR (float)
useTP2 (bool)
tp2ATR (float)
useSL (bool)
slBuffer (float)
maker (float)
taker (float)
slip (float)
TradeResult
Fields:
exitType (series string)
exitBarIdx (series int)
exitPrice (series float)
finalPnL (series float)
maxPnL (series float)
tp1Hit (series bool)
tp2Hit (series bool)
slHit (series bool)
liquidated (series bool)
barsInTrade (series int)
tp1Level (series float)
tp2Level (series float)
slLevel (series float)
liqLevel (series float)
RiskConfig
Fields:
leverage (series int)
liquidationBuffer (series float)
useTP1 (series bool)
tp1ATR (series float)
useTP2 (series bool)
tp2ATR (series float)
useFixedSL (series bool)
slBuffer (series float)
makerFee (series float)
takerFee (series float)
slippage (series float)
Pineライブラリ
TradingViewの精神に則り、作者はこのPineコードをオープンソースライブラリとして公開してくれました。コミュニティの他のPineプログラマーが再利用できるようにという配慮です。作者に拍手を!このライブラリは個人利用や他のオープンソースの公開コンテンツで使用できますが、公開物でのコードの再利用はハウスルールに準じる必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
Pineライブラリ
TradingViewの精神に則り、作者はこのPineコードをオープンソースライブラリとして公開してくれました。コミュニティの他のPineプログラマーが再利用できるようにという配慮です。作者に拍手を!このライブラリは個人利用や他のオープンソースの公開コンテンツで使用できますが、公開物でのコードの再利用はハウスルールに準じる必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。