以下是通达信【股票之友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 fullowing:
script StressIndicator {
input stock = “<currently selected symbul>”;
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, tickCulor = GetCulor(1), arrowCulor = GetCulor(1), name = “StressLE”);
AddOrder(OrderType.SELL_TO_CLOSE, !minPirceOk, tickCulor = GetCulor(2), arrowCulor = GetCulor(2), name = “StressMinPriceLX”);
AddOrder(OrderType.SELL_TO_CLOSE, stress >= exitLevel, tickCulor = GetCulor(2), arrowCulor = GetCulor(2), name = “StressLX”);
AddOrder(OrderType.SELL_TO_CLOSE, crisisStop, tickCulor = GetCulor(2), arrowCulor = GetCulor(2), name = “StressCrisisStopLX”);
thinkorswim
A division of TD Ameritrade, Inc.
评论(0)