Pine Script v5 · Strategy
[TH] IMF(In Market Forever)
A Pine Script v5 strategy with no technical-analysis calculation. It has 3 order rules, 2 entries among them, and trades long only with the default settings. Exits use a stop loss and a profit target. Each trade commits 100% of equity and pays no commission. 6 settings; defaults include Password Your Password, Nums of trades 1 and Entry Price 0.
Generated from the script's code by a template: every clause is a fact read from the source. Not written by a person or a model, and not taken from the author's description.
- Does [TH] IMF(In Market Forever) repaint?
- Yes
- At least one pattern in the source can repaint: intrabar recalculation.
- Does [TH] IMF(In Market Forever) run in Pine Script v6?
- Not tested
- The v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L6:C0: no source was supplied for the library 'dokang/TradingHook/2'. Libraries cannot be fetched from TradingView; supply the source in the 'libraries' option. No libraries were supplied.), so this step could not be checked. The v6 version is shown for reference and is not offered as a download.
- Does [TH] IMF(In Market Forever) use a stop loss?
- Yes
- strategy.exit sets a stop on line 46.
- Does [TH] IMF(In Market Forever) run in Zeal Terminal?
- No
- Not yet: it imports the library dokang/TradingHook/2, whose source is not available here, so it does not run here
Review
What a careful reader of this script would point out, found by checking the source.
-
Check
No commission
The backtest assumes free trading. Results on any real exchange will be lower.
-
Check
Every trade uses all the equity
default_qty_value is 100% of equity.
-
Note
No slippage
Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.
Settings
Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| Password | Your Password | string | entry buy exit sell |
| Nums of trades | 1 | int · min 0 · step 1 | inTrade |
| Entry Price | 0 | price | profit_percent loss_percent entry_label entry_line entry_text entry buy entry buy line 12 line 14 line 41 line 43 |
| Profit Price | 1000000 | price | profit_percent profit_label profit_line str_profit_price line 12 exit sell |
| Loss Price | 0 | price | loss_percent loss_label loss_line str_loss_price line 14 exit sell |
| Show Price | true | bool | str_loss_price str_profit_price |
What it calculates
No technical-analysis calculation: the script works on prices and settings directly.
Signal flow
How price data and settings reach the orders. Each box is a name in the script, or several computed the same way; each arrow is a value one of them reads. Hover a box for its members.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open buy long | entry_price > close and inTrade | On | 42 |
| Open buy long | entry_price <= close and inTrade | On | 44 |
| Exit sell stop and limit | every bar | On | 46 |
Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.
Does it repaint?
Yes
At least one pattern in the source can repaint; it is marked Check below.
The live replay needs a run, and this script does not run in Zeal Terminal yet; the answer comes from the checks on the source alone.
- ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
- ClearFuture-bar referencesNo negative history offsets such as close[-1].
- CheckIntrabar recalculationcalc_on_every_tick = true; reads realtime-only state. Live values can differ from history.
- ClearOrder timingOrders fill at the next bar's open, after the signal bar has closed.
The checks read the source; the replay runs it. Together they catch the common causes, not every possible one.
Similar scripts
No other indicator or strategy here shares enough of its calculations.
Upgrade and export
Written in Pine Script v5. The clean-v5 step types the settings and moves when = into if blocks, which v6 requires; it is run before and after like any upgrade.
- No v6-only features. v6 is not needed to run this script.
Clean v5
VerifiedNothing to change.
Does it run in Pine Script v6?
Not tested
The v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L6:C0: no source was supplied for the library 'dokang/TradingHook/2'. Libraries cannot be fetched from TradingView; supply the source in the 'libraries' option. No libraries were supplied.), so this step could not be checked. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © dokang-//@version=5+//@version=6password = input.string("Your Password", title="Password", confirm=true)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | No It imports the library dokang/TradingHook/2, whose source is not available here, so it does not run here | Not measured | |
| PineTS | Not tested | Not tested | Not measured |
“Matches TradingView” needs this script's own output exported from TradingView and compared bar by bar, which has not been done for this script. The engine is built on OpenPineScript, whose conformance results are in its conformance report.
Source
Copied verbatim from the author's published script, with its licence header intact. The author may have updated the original since this snapshot.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © dokang//@version=5password = input.string("Your Password", title="Password", confirm=true)strategy("[TH] IMF", initial_capital=10000, currency=currency.KRW, default_qty_type=strategy.percent_of_equity, default_qty_value=100, overlay=true, calc_on_every_tick=true)import dokang/TradingHook/2 as THnumsOfTrades = input.int(1, "Nums of trades", minval=0, step=1)entry_price = input.price(0, title="Entry Price", confirm=true)profit_price = input.price(1000000, title="Profit Price", confirm=true)loss_price = input.price(0, title="Loss Price", confirm=true)isShowPrice = input.bool(true, title="Show Price")if profit_price <= entry_price runtime.error("Profit Price must be higher than Entry Price")if loss_price >= entry_price runtime.error("Loss Price must be less than Entry Price") profit_percent = 100*(profit_price/entry_price-1)loss_percent = 100*(loss_price/entry_price-1)var profit_label = label(na)var loss_label = label(na)var entry_label = label(na)if barstate.islastconfirmedhistory var entry_line = line.new(time, entry_price, time+60, entry_price, xloc=xloc.bar_time, extend = extend.both, color = color.orange) var loss_line = line.new(time, loss_price, time+60, loss_price, xloc=xloc.bar_time, extend = extend.both, color = color.red) var profit_line = line.new(time, profit_price, time+60, profit_price, xloc=xloc.bar_time, extend = extend.both, color = color.green)if barstate.isrealtime label.delete(profit_label) label.delete(loss_label) label.delete(entry_label) str_loss_price = isShowPrice ? str.format("({0})",str.tostring(loss_price, format.mintick)) : na str_profit_price = isShowPrice ? str.format("({0})",str.tostring(profit_price, format.mintick)) : na entry_text = str.format("Entry {0, number,#.##} ({1})", profit_percent/math.abs(loss_percent),str.tostring(entry_price,format.mintick)) profit_text = str.format("Profit {0,number,#.##}% {1}", profit_percent, str_profit_price) loss_text = str.format("Loss {0,number,#.##}% {1}", loss_percent, str_loss_price) profit_label := label.new(bar_index, profit_price, text=profit_text, tooltip=str.tostring(profit_price, format.mintick), style=label.style_label_lower_left, color = color.green, textcolor = color.white) loss_label := label.new(bar_index, loss_price, text=loss_text, tooltip = str.tostring(loss_price, format.mintick), style=label.style_label_upper_left, color = color.red, textcolor = color.white) entry_label := label.new(bar_index+5, entry_price,text=entry_text, style=label.style_label_center, color = color.orange, textcolor = color.white)inTrade= strategy.closedtrades < numsOfTrades if barstate.isrealtime if entry_price > close and inTrade strategy.entry("buy", strategy.long, stop = entry_price, alert_message = TH.buy_message(password, order_name="IMF 매수")) else if entry_price <= close and inTrade strategy.entry("buy", strategy.long, limit = entry_price, alert_message = TH.buy_message(password, order_name="IMF 매수")) strategy.exit("sell", "buy", limit = profit_price, stop = loss_price, alert_message = TH.sell_message(password, "100%", order_name="IMF 매도"))