@guihz/trading-vue-editor-tes 0.0.296 → 0.0.297

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,7 +66,7 @@ interface IOrderArgs {
66
66
  comment_trailing?: string;
67
67
  last_commission?: number;
68
68
  }
69
- type PlaceOrderType = 'order' | 'entry' | 'exit' | 'close' | 'close_all';
69
+ type PlaceOrderType = 'order' | 'entry' | 'exit' | 'close' | 'close_all' | 'close_all_short' | 'close_all_long';
70
70
  export interface IOrder extends IOrderArgs {
71
71
  isMarketPrice?: boolean;
72
72
  out_id?: string;
@@ -181,6 +181,8 @@ export default class Strategy {
181
181
  entry(args: IOrderArgs, posStr: string): void;
182
182
  close(args: IOrder, posStr: string): void;
183
183
  close_all(args: IOrder, posStr: string): void;
184
+ close_all_long(args: IOrder, posStr: string): void;
185
+ close_all_short(args: IOrder, posStr: string): void;
184
186
  cancel({ id }: {
185
187
  id: string;
186
188
  }, posStr: string): void;
@@ -215,6 +217,7 @@ export default class Strategy {
215
217
  private _getEntryOrders;
216
218
  private _addPendingEntry;
217
219
  private _closeAllOrders;
220
+ private _closeAllPartOrders;
218
221
  private _closeOrders;
219
222
  private _closeOrder;
220
223
  private _exitOrdersHandle;
@@ -31908,6 +31908,140 @@ else
31908
31908
  "void"
31909
31909
  ]
31910
31910
  },
31911
+ {
31912
+ name: "strategy.close_all_long",
31913
+ desc: [
31914
+ "退出当前市场多单仓位,使其持平。"
31915
+ ],
31916
+ args: [
31917
+ {
31918
+ name: "comment",
31919
+ desc: "可选参数。订单的其他说明。",
31920
+ allowedTypeIDs: [
31921
+ "series string",
31922
+ "simple string",
31923
+ "input string",
31924
+ "const string"
31925
+ ],
31926
+ displayType: "series string"
31927
+ },
31928
+ {
31929
+ name: "alert_message",
31930
+ desc: '一个可选参数,用于在“创建警报”对话框的"消息"字段中使用时替换{{strategy.order.alert_message}}占位符。',
31931
+ allowedTypeIDs: [
31932
+ "series string",
31933
+ "simple string",
31934
+ "input string",
31935
+ "const string"
31936
+ ],
31937
+ displayType: "series string"
31938
+ },
31939
+ {
31940
+ name: "immediately",
31941
+ desc: "可选参数。如果[true](#const_true),平仓订单将在它被放置的tick执行,忽略限制订单执行到下一根K线开盘的策略参数。默认值为[false](#const_false)。",
31942
+ allowedTypeIDs: [
31943
+ "series bool",
31944
+ "simple bool",
31945
+ "input bool",
31946
+ "const bool"
31947
+ ],
31948
+ displayType: "series bool"
31949
+ },
31950
+ {
31951
+ name: "disable_alert",
31952
+ desc: "如果函数创建订单时为[true](#const_true),策略警报将不会在该订单执行时触发。该参数接受“series bool”参数,允许用户控制哪些订单在成交时触发警报。可选。默认值为[false](#const_false)。",
31953
+ allowedTypeIDs: [
31954
+ "series bool",
31955
+ "simple bool",
31956
+ "input bool",
31957
+ "const bool"
31958
+ ],
31959
+ displayType: "series bool"
31960
+ }
31961
+ ],
31962
+ examples: [
31963
+ "//@version=1",
31964
+ 'strategy("closeAll Demo", overlay=false)',
31965
+ "if open > close",
31966
+ ' strategy.entry("buy", strategy.long)',
31967
+ "if open < close",
31968
+ ' strategy.close_all_long(comment = "close all entries")',
31969
+ "plot(strategy.position_size)"
31970
+ ],
31971
+ syntax: [
31972
+ "strategy.close_all_long(comment, alert_message, immediately, disable_alert) → void"
31973
+ ],
31974
+ returnedTypes: [
31975
+ "void"
31976
+ ]
31977
+ },
31978
+ {
31979
+ name: "strategy.close_all_short",
31980
+ desc: [
31981
+ "退出当前市场空单仓位,使其持平。"
31982
+ ],
31983
+ args: [
31984
+ {
31985
+ name: "comment",
31986
+ desc: "可选参数。订单的其他说明。",
31987
+ allowedTypeIDs: [
31988
+ "series string",
31989
+ "simple string",
31990
+ "input string",
31991
+ "const string"
31992
+ ],
31993
+ displayType: "series string"
31994
+ },
31995
+ {
31996
+ name: "alert_message",
31997
+ desc: '一个可选参数,用于在“创建警报”对话框的"消息"字段中使用时替换{{strategy.order.alert_message}}占位符。',
31998
+ allowedTypeIDs: [
31999
+ "series string",
32000
+ "simple string",
32001
+ "input string",
32002
+ "const string"
32003
+ ],
32004
+ displayType: "series string"
32005
+ },
32006
+ {
32007
+ name: "immediately",
32008
+ desc: "可选参数。如果[true](#const_true),平仓订单将在它被放置的tick执行,忽略限制订单执行到下一根K线开盘的策略参数。默认值为[false](#const_false)。",
32009
+ allowedTypeIDs: [
32010
+ "series bool",
32011
+ "simple bool",
32012
+ "input bool",
32013
+ "const bool"
32014
+ ],
32015
+ displayType: "series bool"
32016
+ },
32017
+ {
32018
+ name: "disable_alert",
32019
+ desc: "如果函数创建订单时为[true](#const_true),策略警报将不会在该订单执行时触发。该参数接受“series bool”参数,允许用户控制哪些订单在成交时触发警报。可选。默认值为[false](#const_false)。",
32020
+ allowedTypeIDs: [
32021
+ "series bool",
32022
+ "simple bool",
32023
+ "input bool",
32024
+ "const bool"
32025
+ ],
32026
+ displayType: "series bool"
32027
+ }
32028
+ ],
32029
+ examples: [
32030
+ "//@version=1",
32031
+ 'strategy("closeAll Demo", overlay=false)',
32032
+ "if open > close",
32033
+ ' strategy.entry("buy", strategy.short)',
32034
+ "if open < close",
32035
+ ' strategy.close_all_short(comment = "close all entries")',
32036
+ "plot(strategy.position_size)"
32037
+ ],
32038
+ syntax: [
32039
+ "strategy.close_all_short(comment, alert_message, immediately, disable_alert) → void"
32040
+ ],
32041
+ returnedTypes: [
32042
+ "void"
32043
+ ]
32044
+ },
31911
32045
  {
31912
32046
  name: "strategy.close",
31913
32047
  desc: [
@@ -48286,7 +48420,7 @@ else
48286
48420
  desc: "未平仓交易的交易编号。第一笔交易的编号为零。",
48287
48421
  required: !0,
48288
48422
  allowedTypeIDs: [
48289
- "const int",
48423
+ "series int",
48290
48424
  "simple int",
48291
48425
  "input int",
48292
48426
  "const int"
@@ -48307,7 +48441,9 @@ else
48307
48441
  "if longCondition",
48308
48442
  ' strategy.entry("Long entry at bar #" + str.tostring(bar_index), strategy.long)',
48309
48443
  "if shortCondition",
48310
- ' strategy.entry("Short entry at bar #" + str.tostring(bar_index), strategy.short)'
48444
+ ' strategy.entry("Short entry at bar #" + str.tostring(bar_index), strategy.short)',
48445
+ "if barstate.islastconfirmedhistory",
48446
+ ' label.new(last_bar_index, high, "Last Entry Direction is: " + strategy.opentrades.direction(strategy.opentrades - 1))'
48311
48447
  ],
48312
48448
  returns: [
48313
48449
  "返回未平仓交易入场的订单方向。"
@@ -69419,7 +69555,7 @@ function xr(a, s, r) {
69419
69555
  function Lw() {
69420
69556
  return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
69421
69557
  }
69422
- const Nd = new Worker(new URL("" + new URL("assets/scriptsRunWorker-CFjAsyQD.js", import.meta.url).href, import.meta.url), { type: "module", name: "Run TccScript Server" });
69558
+ const Nd = new Worker(new URL("" + new URL("assets/scriptsRunWorker-mnkZx4p2.js", import.meta.url).href, import.meta.url), { type: "module", name: "Run TccScript Server" });
69423
69559
  Nd.onerror = (a) => {
69424
69560
  console.error(a);
69425
69561
  };