Pine Script v4 · Strategy
[001] Entry_Test [TradeStand]
A Pine Script v4 strategy built on SMA (close, 5). It has 6 order rules, 4 entries among them, and trades long and short with the default settings. Exits wait for a signal; there is no stop loss. Each trade is one contract and pays no commission. 7 settings; defaults include トレードモード OFF, 日足MA表示 OFF and 秒数 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 [001] Entry_Test [TradeStand] repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
- How did [001] Entry_Test [TradeStand] do on BTCUSDT 1D with default settings?
- Not measured
- It closed no trades there from 26 Jan 2024 to 21 Oct 2026 with the default settings, so there is no result to report. Its code limits trading to a date window, which can leave this period out. It closed no trades on the other markets either. A backtest, not investment advice.
- Can [001] Entry_Test [TradeStand] be converted to Pine Script v5?
- Not tested
- The steps are shown below, but neither version placed a trade on any market tested, so there was nothing to compare and no download is offered.
- Does [001] Entry_Test [TradeStand] use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does [001] Entry_Test [TradeStand] run in Zeal Terminal?
- Yes
- It compiles in 46 ms and runs 1,000 bars in 98 ms, in the browser.
BTCUSDT · 1D · default settings
- 日足5MA
- 日足25MA
- 日足75MA
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- 0.00%
- $0.00
- Buy and hold
- +102.5%
- same period
- Closed trades
- 0
- 0 won · 0 lost
- Profitable
- 0.0%
- of closed trades
- Profit factor
- —
- gross profit ÷ gross loss
- Max drawdown
- 0.00%
- $0.00
One run with the author's default settings, $100,000 starting capital, commission as the script sets it. A single backtest says little about future results and is not a recommendation. Backtests are simulations on historical data and are not investment advice.
Review
What a careful reader of this script would point out, found by checking the source and the backtest.
-
Check
3 settings do nothing
“▒▒▒▒▒▒▒▒▒▒▒▒▒ トレードモード ▒▒▒▒▒▒▒▒▒▒▒▒▒”, “▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 表 示 ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒”, “▒▒▒▒▒▒▒▒▒▒▒▒▒▒ トレード条件 ▒▒▒▒▒▒▒▒▒▒▒▒▒” are declared but never read.
-
Check
No stop loss
Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.
-
Check
No commission
The backtest assumes free trading. Results on any real exchange will be lower.
-
Note
No slippage
Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.
-
Note
Uses an argument v6 removed
when = on line 172, 177. The upgraded version below moves each call inside an if block.
Upgrade and export
Written in Pine Script v4. The upgrade to v5 takes 1 step, one per version, each applied to the result of the one before. A last clean-v5 pass then types the settings and moves when = into if blocks, which v6 requires. Every step runs before and after on the same candles in Zeal Terminal's engine; a step whose results differ is shown but not offered as a download. Upgrades preserve behaviour: bugs are fixed in the Review, never silently here.
- Upgrading to v5 renames security → request.security, sma → ta.sma.
- 2 strategy calls use the when = argument (line 172, 177). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
v4 → v5
Not verifiedNeither version placed a trade on any of the 8 markets, so there was nothing to compare.
- Line 3: //@version=4 → //@version=5
- Line 11: input(type = input.bool) → input.bool()
- Line 13: input(type = input.bool) → input.bool()
- Line 15: input(type = input.bool) → input.bool()
- Line 16: input(type = input.time) → input.time()
- Line 109: security → request.security
9 more edits
- Line 109: sma → ta.sma
- Line 109: sma → ta.sma
- Line 109: sma → ta.sma
- Line 109: sma → ta.sma
- Line 109: sma → ta.sma
- Line 109: sma → ta.sma
- Line 109: sma → ta.sma
- Line 109: sma → ta.sma
- Line 109: sma → ta.sma
⋯// © Dr_KV-//@version=4+//@version=5strategy("[001] Entry_Test [TradeStand]", overlay=true)⋯//////////////////////////////////-Section1 = input(title = "▒▒▒▒▒▒▒▒▒▒▒▒▒ トレードモード ▒▒▒▒▒▒▒▒▒▒▒▒▒", defval = true, type = input.bool)+Section1 = input.bool(title = "▒▒▒▒▒▒▒▒▒▒▒▒▒ トレードモード ▒▒▒▒▒▒▒▒▒▒▒▒▒", defval = true)int_TradeMode = input("OFF", options = ["OFF","新規買い","新規売り","返済買い","返済売り"], title = "トレードモード")-Section71 = input(title = "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 表 示 ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒", defval = true, type = input.bool)+Section71 = input.bool(title = "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 表 示 ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒", defval = true)int_MA_monitor = input("OFF", options = ["OFF","ON"], title = "日足MA表示")-Section3 = input(title = "▒▒▒▒▒▒▒▒▒▒▒▒▒▒ トレード条件 ▒▒▒▒▒▒▒▒▒▒▒▒▒", defval = true, type = input.bool)+Section3 = input.bool(title = "▒▒▒▒▒▒▒▒▒▒▒▒▒▒ トレード条件 ▒▒▒▒▒▒▒▒▒▒▒▒▒", defval = true)-i_startTime = input(defval = timestamp("18 oct 2021 13:30 +0900"), title = "実行日時", type = input.time)+i_startTime = input.time(defval = timestamp("18 oct 2021 13:30 +0900"), title = "実行日時")i_byou = input(0, minval = 0, maxval = 59, title = " 秒数")⋯//短期 中期 長期 基準 MA-[ma_short_D,ma_short_prev_D,ma_short_prev2_D,ma_middle_D,ma_middle_prev_D,ma_middle_prev2_D,ma_long,ma_long_prev,ma_long_prev2] = security(syminfo.tickerid, "D", [sma(close, 5)[0],sma(close, 5)[1],sma(close, 5)[2],sma(close, 25)[0],sma(close, 25)[1],sma(close, 25)[2],sma(close, 75)[0],sma(close, 75)[1],sma(close, 75)[2]], barmerge.gaps_off, barmerge.lookahead_off)+[ma_short_D,ma_short_prev_D,ma_short_prev2_D,ma_middle_D,ma_middle_prev_D,ma_middle_prev2_D,ma_long,ma_long_prev,ma_long_prev2] = request.security(syminfo.tickerid, "D", [ta.sma(close, 5)[0],ta.sma(close, 5)[1],ta.sma(close, 5)[2],ta.sma(close, 25)[0],ta.sma(close, 25)[1],ta.sma(close, 25)[2],ta.sma(close, 75)[0],ta.sma(close, 75)[1],ta.sma(close, 75)[2]], barmerge.gaps_off, barmerge.lookahead_off)ma_short = var_everyday_cnt < 5 ? ma_short_D : (close + close_yesterday + close_2days_ago + close_3days_ago + close_4days_ago )/5⋯Clean v5
Not verifiedNeither version placed a trade on any of the 8 markets, so there was nothing to compare.
- Line 12: input() → input.string()
- Line 14: input() → input.string()
- Line 17: input() → input.int()
- Line 172: when = inDateRange_2 and var_position_count_entry_only == 0 → if block
- Line 177: when = inDateRange_2 and var_position_count_entry_only == 0 → if block
⋯Section1 = input.bool(title = "▒▒▒▒▒▒▒▒▒▒▒▒▒ トレードモード ▒▒▒▒▒▒▒▒▒▒▒▒▒", defval = true)-int_TradeMode = input("OFF", options = ["OFF","新規買い","新規売り","返済買い","返済売り"], title = "トレードモード")+int_TradeMode = input.string("OFF", options = ["OFF","新規買い","新規売り","返済買い","返済売り"], title = "トレードモード")Section71 = input.bool(title = "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 表 示 ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒", defval = true)-int_MA_monitor = input("OFF", options = ["OFF","ON"], title = "日足MA表示")+int_MA_monitor = input.string("OFF", options = ["OFF","ON"], title = "日足MA表示")Section3 = input.bool(title = "▒▒▒▒▒▒▒▒▒▒▒▒▒▒ トレード条件 ▒▒▒▒▒▒▒▒▒▒▒▒▒", defval = true)i_startTime = input.time(defval = timestamp("18 oct 2021 13:30 +0900"), title = "実行日時")-i_byou = input(0, minval = 0, maxval = 59, title = " 秒数")+i_byou = input.int(0, minval = 0, maxval = 59, title = " 秒数")int_EntryLimit_cMA_switch = "OFF"⋯//決済 //////////////////////////////////////////-strategy.close(":新規買い",- comment = ':返済売り',- alert_message=strategy_code ,- when = inDateRange_2 and var_position_count_entry_only == 0- )+if inDateRange_2 and var_position_count_entry_only == 0+ strategy.close(":新規買い",+ comment = ':返済売り',+ alert_message=strategy_code + )-strategy.close(":新規売り",- comment = ':返済買い',- alert_message=strategy_code ,- when = inDateRange_2 and var_position_count_entry_only == 0- )+if inDateRange_2 and var_position_count_entry_only == 0+ strategy.close(":新規売り",+ comment = ':返済買い',+ alert_message=strategy_code + )Does it run in Pine Script v6?
Not tested
Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © Dr_KV-//@version=5+//@version=6strategy("[001] Entry_Test [TradeStand]", overlay=true)⋯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 |
|---|---|---|---|
| ▒▒▒▒▒▒▒▒▒▒▒▒▒ トレードモード ▒▒▒▒▒▒▒▒▒▒▒▒▒ | true | bool | unused |
| トレードモード | OFF | string · options ["OFF","新規買い","新規売り","返済買い","返済売り"] | entry :新規買い entry :新規売り entry :新規買い entry :新規売り line 156 line 159 line 163 line 167 |
| ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 表 示 ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ | true | bool | unused |
| 日足MA表示 | OFF | string · options ["OFF","ON"] | ma_short_monitor ma_middle_monitor ma_long_monitor 日足5MA 日足25MA 日足75MA |
| ▒▒▒▒▒▒▒▒▒▒▒▒▒▒ トレード条件 ▒▒▒▒▒▒▒▒▒▒▒▒▒ | true | bool | unused |
| 実行日時 | timestamp("18 oct 2021 13:30 +0900") | time | inDateRange |
| 秒数 | 0 | int · min 0 · max 59 | var_byou |
What it calculates
- SMA (
sma,ta.smain v5)close, 5ma_short_D · line 109 - SMA (
sma,ta.smain v5)close, 5ma_short_prev_D · line 109 - SMA (
sma,ta.smain v5)close, 5ma_short_prev2_D · line 109 - SMA (
sma,ta.smain v5)close, 5ma_middle_D · line 109 - SMA (
sma,ta.smain v5)close, 5ma_middle_prev_D · line 109 - SMA (
sma,ta.smain v5)close, 5ma_middle_prev2_D · line 109 - SMA (
sma,ta.smain v5)close, 5ma_long · line 109 - SMA (
sma,ta.smain v5)close, 5ma_long_prev · line 109 - SMA (
sma,ta.smain v5)close, 5ma_long_prev2 · line 109
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.
The script has 74 named inputs, calculations, conditions and outputs, too many to draw legibly here; the tables above list them.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open :新規買い long | (int_TradeMode == "返済売り" and var_position_count == 0 and time[1] != time) | On | 157 |
| Open :新規売り short | (int_TradeMode == "返済買い" and var_position_count == 0 and time[1] != time) | On | 160 |
| Open :新規買い long | ((int_TradeMode == "新規買い")and inDateRange_2 and var_position_count == 0) | On | 164 |
| Open :新規売り short | ((int_TradeMode == "新規売り")and inDateRange_2 and var_position_count == 0) | On | 168 |
| Close :新規買い | inDateRange_2 and var_position_count_entry_only == 0 | On | 172 |
| Close :新規売り | inDateRange_2 and var_position_count_entry_only == 0 | On | 177 |
Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.
Does it repaint?
No
No repainting patterns in the source.
- ClearHigher-timeframe data1 security call(s), none with lookahead on.
- ClearFuture-bar referencesNo negative history offsets such as close[-1].
- ClearIntrabar recalculationNo varip, calc_on_every_tick or realtime-only state. Orders are decided once per closed bar.
- 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.
Other markets
The same script with default settings on 8 Binance markets. Each row is a separate backtest over the most recent 1,000 bars.
| Market | Net | Buy and hold | Trades | Won | Profit factor | Max drawdown | Period |
|---|---|---|---|---|---|---|---|
| BTCUSDT 1D | 0.0% | +102.5% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | 0.0% | +5.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | 0.0% | +9.8% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | 0.0% | +8.4% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | 0.0% | +16.7% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | 0.0% | +21.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | 0.0% | +148.3% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | 0.0% | +17.1% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
Backtests are simulations on historical data and are not investment advice.
Similar scripts
Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| [001] Entry_Test [TradeStand] this page | — | v4 strategy | 0.0% | 0 | 0.0% |
| Follow the Crypto Shorts by xtradernet | sma | v4 strategy | No trades on this market | ||
| buy down and sell high trend 200 sma and ma cross by willi130503 | sma | v4 strategy | No trades on this market | ||
| Mayer Multiple Strategy by xtradernet | sma | v4 strategy | No trades on this market | ||
| Moving Average Cross Strategy early Closing by Geduldtrader | sma | v4 strategy | +73.8% | 20 | 151.5% |
| MFI Simple Strategy by OztheWoz | sma | v5 strategy | −0.2% | 28 | 3.2% |
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 46 ms | Yes 1,000 bars in 98 ms | Not measured |
| PineTS | No v5 and v6 only | — | 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. PineTS runs Pine Script v5 and v6 only.
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/// © Dr_KV//@version=4strategy("[001] Entry_Test [TradeStand]", overlay=true)strategy_code = "tradestand"////////////////////////////////////// インプット////////////////////////////////////Section1 = input(title = "▒▒▒▒▒▒▒▒▒▒▒▒▒ トレードモード ▒▒▒▒▒▒▒▒▒▒▒▒▒", defval = true, type = input.bool)int_TradeMode = input("OFF", options = ["OFF","新規買い","新規売り","返済買い","返済売り"], title = "トレードモード")Section71 = input(title = "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 表 示 ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒", defval = true, type = input.bool)int_MA_monitor = input("OFF", options = ["OFF","ON"], title = "日足MA表示")Section3 = input(title = "▒▒▒▒▒▒▒▒▒▒▒▒▒▒ トレード条件 ▒▒▒▒▒▒▒▒▒▒▒▒▒", defval = true, type = input.bool)i_startTime = input(defval = timestamp("18 oct 2021 13:30 +0900"), title = "実行日時", type = input.time)i_byou = input(0, minval = 0, maxval = 59, title = " 秒数")int_EntryLimit_cMA_switch = "OFF"int_EntryLimit_cMA_MA = "OFF"int_EntryLimit_cMA_jg_switch = "超えたら"////////////////////////////////////// 素材//////////////////////////////////////移動平均線 ////////////////////////////////////////////////////////////////////////////////////////////////////////当日~3日前 4本値var float open_today = openvar float high_today = openvar float low_today = openvar float open_yesterday = openvar float high_yesterday = highvar float low_yesterday = lowvar float open_2days_ago = openvar float high_2days_ago = highvar float low_2days_ago = lowvar float open_3days_ago = openvar float high_3days_ago = highvar float low_3days_ago = lowvar float close_yesterday = closevar float close_2days_ago = closevar float close_3days_ago = closevar float close_4days_ago = closevar float close_5days_ago = closevar float close_6days_ago = closevar float close_7days_ago = closevar float close_8days_ago = closevar float close_9days_ago = closevar float close_10days_ago = closevar float close_11days_ago = closevar float close_12days_ago = closevar float close_13days_ago = closevar float close_14days_ago = closevar float close_15days_ago = closevar float close_16days_ago = closevar float close_17days_ago = closevar float close_18days_ago = closevar float close_19days_ago = closevar float close_20days_ago = closevar float close_21days_ago = closevar float close_22days_ago = closevar float close_23days_ago = closevar float close_24days_ago = closeif(dayofweek[1] != dayofweek) open_today := open high_today := high low_today := low open_yesterday := open_today[1] high_yesterday := high_today[1] low_yesterday := low_today[1] open_2days_ago := open_yesterday[1] high_2days_ago := high_yesterday[1] low_2days_ago := low_yesterday[1] open_3days_ago := open_2days_ago[1] high_3days_ago := high_2days_ago[1] low_3days_ago := low_2days_ago[1] close_yesterday := close[1] close_2days_ago := close_yesterday[1] close_3days_ago := close_2days_ago[1] close_4days_ago := close_3days_ago[1] close_5days_ago := close_4days_ago[1] close_6days_ago := close_5days_ago[1] close_7days_ago := close_6days_ago[1] close_8days_ago := close_7days_ago[1] close_9days_ago := close_8days_ago[1] close_10days_ago:=close_9days_ago[1] close_11days_ago:=close_10days_ago[1] close_12days_ago:=close_11days_ago[1] close_13days_ago:=close_12days_ago[1] close_14days_ago:=close_13days_ago[1] close_15days_ago:=close_14days_ago[1] close_16days_ago:=close_15days_ago[1] close_17days_ago:=close_16days_ago[1] close_18days_ago:=close_17days_ago[1] close_19days_ago:=close_18days_ago[1] close_20days_ago:=close_19days_ago[1] close_21days_ago:=close_20days_ago[1] close_22days_ago:=close_21days_ago[1] close_23days_ago:=close_22days_ago[1] close_24days_ago:=close_23days_ago[1]//日々カウントvar int var_everyday_cnt = 1if(dayofweek[1] != dayofweek ) var_everyday_cnt := var_everyday_cnt +1//短期 中期 長期 基準 MA[ma_short_D,ma_short_prev_D,ma_short_prev2_D,ma_middle_D,ma_middle_prev_D,ma_middle_prev2_D,ma_long,ma_long_prev,ma_long_prev2] = security(syminfo.tickerid, "D", [sma(close, 5)[0],sma(close, 5)[1],sma(close, 5)[2],sma(close, 25)[0],sma(close, 25)[1],sma(close, 25)[2],sma(close, 75)[0],sma(close, 75)[1],sma(close, 75)[2]], barmerge.gaps_off, barmerge.lookahead_off)ma_short = var_everyday_cnt < 5 ? ma_short_D : (close + close_yesterday + close_2days_ago + close_3days_ago + close_4days_ago )/5ma_middle = var_everyday_cnt < 25 ? ma_middle_D : (close + close_yesterday + close_2days_ago + close_3days_ago + close_4days_ago + close_5days_ago + close_6days_ago + close_7days_ago + close_8days_ago + close_9days_ago + close_10days_ago + close_11days_ago + close_12days_ago + close_13days_ago + close_14days_ago + close_15days_ago + close_16days_ago + close_17days_ago + close_18days_ago + close_19days_ago + close_20days_ago + close_21days_ago + close_22days_ago + close_23days_ago + close_24days_ago)/25ma_short_monitor = int_MA_monitor == "ON" ? ma_short : closema_middle_monitor = int_MA_monitor == "ON" ? ma_short : closema_long_monitor = int_MA_monitor == "ON" ? ma_long : closeplot(ma_short_monitor, color = int_MA_monitor == "ON" ? color.aqua : na, linewidth=2, title="日足5MA")plot(ma_middle_monitor, color = int_MA_monitor == "ON" ? color.yellow : na , linewidth=2, title="日足25MA")plot(ma_long_monitor, color = int_MA_monitor == "ON" ? color.lime : na , linewidth=2, title="日足75MA")////////////////////////////////////// ロジック////////////////////////////////////// 実行時間 //////////////////////////////////////////////////////////////////////////////////////////////////////inDateRange = time >= i_startTimevar int var_byou = 0if(dayofweek[1] != dayofweek) var_byou := 0if(inDateRange[1] == false and inDateRange == true ) var_byou := time + i_byou*1000//inDateRange_2 = 実行時間満たしinDateRange_2 = time >= var_byou and inDateRange// 日足MA基準トレード ////////////////////////////////////////////////////////////////////////////ver_EntryLimit_cMA_line = int_EntryLimit_cMA_MA == "5MA" ? ma_short : int_EntryLimit_cMA_MA == "25MA" ? ma_middle : int_EntryLimit_cMA_MA == "75MA" ? ma_long : closeCondition_EntryLimit_cMA_buysell = (int_EntryLimit_cMA_switch == "OFF") ? true : (int_EntryLimit_cMA_jg_switch == "超えたら" and close > ver_EntryLimit_cMA_line) or (int_EntryLimit_cMA_jg_switch == "割ったら" and close < ver_EntryLimit_cMA_line)////////////////////////////////////// ロジック まとめ////////////////////////////////////logic_pass = inDateRange_2 and Condition_EntryLimit_cMA_buysell////////////////////////////////////// 処理まとめ////////////////////////////////////var int var_position_count = 0var int var_position_count_entry_only = 0//ポジション取ったよif(var_position_count == 0 and strategy.position_size[1] == 0 and strategy.position_size != 0) var_position_count := var_position_count + 1//先に買っとくif (int_TradeMode == "返済売り" and var_position_count == 0 and time[1] != time) strategy.entry(":新規買い", strategy.long, alert_message=strategy_code) var_position_count := var_position_count + 1if (int_TradeMode == "返済買い" and var_position_count == 0 and time[1] != time) strategy.entry(":新規売り", strategy.short, alert_message=strategy_code) var_position_count := var_position_count + 1//エントリー ///////////////////////////////////if ((int_TradeMode == "新規買い")and inDateRange_2 and var_position_count == 0) strategy.entry(":新規買い", strategy.long, qty = 10000000, alert_message=strategy_code) var_position_count := var_position_count + 1 var_position_count_entry_only := var_position_count_entry_only + 1if ((int_TradeMode == "新規売り")and inDateRange_2 and var_position_count == 0) strategy.entry(":新規売り", strategy.short, qty = 10000000, alert_message=strategy_code) var_position_count := var_position_count + 1 var_position_count_entry_only := var_position_count_entry_only + 1//決済 //////////////////////////////////////////strategy.close(":新規買い", comment = ':返済売り', alert_message=strategy_code , when = inDateRange_2 and var_position_count_entry_only == 0 )strategy.close(":新規売り", comment = ':返済買い', alert_message=strategy_code , when = inDateRange_2 and var_position_count_entry_only == 0 )