通达信【股票之友S理论】——对比逻辑

我本善良,沉默非弱!
最近,论坛有些友友对我很不满,严重质疑我的技术水平,我在本贴再次申明,我发贴是我兴趣,同时帮助喜欢我风格的友友们,早些建立自己的交易策略模型.
我绝对不会卖指标,也没有这必要! 有本事就明目张胆地挑战我,不要鬼鬼祟祟的!

以下是一个国外知名市场时机逻辑指标,有本事就编写出来,没本事就不要再打扰我,谢谢!

国外知名市场时机逻辑指标原本:
In “Timing The Market With Pairs Logic” in this issue, author Perry Kaufman explains how to backtest the idea of hedging with an index-based ETF. Based on his article, we have created two new strategies and a new study for thinkorswim users in our proprietary scripting language, thinkScript. One strategy is for the equity and the other strategy is for the ETF.
For the Equity Strategy click here or:

From our TOS Charts, Select Studies → Edit Studies.
Select the Strategy tab in the upper left hand corner.
Select New in the lower left hand corner.
Name the strategy (i.e. Stress)
Click in the script editor window, remove “addOrder(OrderType.BUY_AUTO, no);” and paste the following:
script StressIndicator {
input stock = "<currently selected symbol>";
input index = "SPY";
input length = 50;

def rangeStock = Highest(high(stock), length) - Lowest(low(stock), length);
plot StochStock = 100 * if rangeStock != 0 then (close(stock) - Lowest(low(stock), length)) / rangeStock else 0;

def rangeIndex = Highest(high(index), length) - Lowest(low(index), length);
plot StochIndex = 100 * if rangeIndex != 0 then (close(index) - Lowest(low(index), length)) / rangeIndex else 0;

def diff = StochStock - StochIndex;
def rangeDiff = Highest(diff, length) - Lowest(diff, length);
plot Stress = 100 * if rangeDiff != 0 then (diff - Lowest(diff, length)) / rangeDiff else 0;
}

input index = "SPY";
input length = 50;
input investment = 5000;
input entryLevel = 10;
input exitLevel = 50;
input stopLoss = 10.0;
input minPrice = 3.0;
input minPriceLength = 5;

def minPirceOk = Lowest(close, minPriceLength) > minPrice;
def stress = reference StressIndicator(index = index, length = length).Stress;
def entryPrice = EntryPrice();
def crisisStop = close / entryPrice - 1 < -stopLoss / 100;
def isReady = if !isReady[1] and stress > 50 then yes else if IsNaN(crisisStop) then isReady[1] else if !IsNaN(entryPrice) and crisisStop then no else isReady[1];

AddOrder(OrderType.BUY_TO_OPEN, isReady and stress <= entryLevel and minPirceOk, tradeSize = investment / close, tickColor = GetColor(1), arrowColor = GetColor(1), name = "StressLE");

AddOrder(OrderType.SELL_TO_CLOSE, !minPirceOk, tickColor = GetColor(2), arrowColor = GetColor(2), name = "StressMinPriceLX");
AddOrder(OrderType.SELL_TO_CLOSE, stress >= exitLevel, tickColor = GetColor(2), arrowColor = GetColor(2), name = "StressLX");
AddOrder(OrderType.SELL_TO_CLOSE, crisisStop, tickColor = GetColor(2), arrowColor = GetColor(2), name = "StressCrisisStopLX");

thinkorswim
A division of TD Ameritrade, Inc.



来函数检测结果如下:
该公式没有未来函数

解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式

联系我们  |  股票指标网  |  指标网   |  指标公式  |   加入收藏   |  设为主页

@2005-2023 粤ICP备2023063687号-2 股票指标网别名指标网仅为互联网文章,所有股票指标公式及文章仅供学习研究,并不构成投资建议,请勿以此为依据进行股票交易,由此引起的投资亏损与本站无关。股票指标网均来源互联网收集整理,如不慎侵犯了你的权益,请联系我们告知,我们将做删除处理
QQ:88652583 微信 88652583
sitemap站点地图