我试图计算一下,如果一只股票在开盘时推高.05的概率,那么它推动.50上涨的可能性有多大?碰上几个打嗝。
这个想法来自一个外汇交易员,“TheRumpledOne”。他称之为“购物区”如果你不认识他就去查查他。把它想象成一个基于概率的开放范围。
加载代码后,可以看到数字不应超过"barsago“长度。
编辑:想出了答案。在代码中添加了“上面的十字”。虽然一定有更好的,“更清洁”的方式?还添加了"...var和.“代码的这一部分,如果真的需要的话,这部分代码就会运行。
def countsells = Sum( var and var1, barsago);编辑2: ,这是我当前的问题。还有其他的问题。数字似乎不对。现在他们看起来很低。我预计一些股票会在70%以上的时间里达到开盘+ .50,但这个指标却有不同的说法。
# (Probabilty of XYZ FROM THE LAST / PAST XYZ BARS )
# Original/base code By XeoNoX via Usethinkscript.com
# Idea by TheRumpledOne
# By Prison Mike
input barsago = 100;
input buy= .05;
def buyzone= (open + buy);
def var = close crosses above buyzone;
def count = Sum(var, barsago);
AddLabel (yes, "COUNT " + (count) );
def pct= round(count/barsago)*100;
AddLabel (yes, "BuyZone " + (pct) );
input Sell= .50;
def sellzone= (open + sell);
def var1 =close crosses above sellzone;
def countsells = Sum(var and var1, barsago);
AddLabel (yes, "COUNT " + (countsells) );
def pct2=round (countsells/barsago)*100;
AddLabel (yes, "SellZone " + (pct2) );发布于 2021-03-24 19:05:00
修改:它计算显示的图表中有多少条条(注意:TheRumpledOne的算法是为日内交易设计的)。它在价格图表上放置一个橙色的向上箭头,只要打开的地方上升了5美分;它在价格上涨50美分的地方放置了绿色箭头。然后,它显示用于计算百分比值的计数、百分比和条数(highestBar值)的标签。
而且,我同意:在AAPL的图表上,数到大约360 15分钟的酒吧,我得到了30%多一点的5美分,只有3%的增长了50美分。这是酒吧总数的一部分;然而,当我添加这个部分来计算卖出数量的百分比时,我仍然只得到了8%左右。在鲁迈尔蒙人的斯托克菲舍尔哨所中没有接近建议的数字。
注意:我用来测试的图表包括了业余时间的酒吧。也许如果我把业余时间排除在外的话,数字会更好吗?考虑到我哪里有箭,我不这么认为.
下面是修改后的脚本:
#hint: from SO: https://stackoverflow.com/q/66232117/1107226\nThinkscript Probabilty Statistics Study- Need help finishing
def highestBar = HighestAll(BarNumber());
### buy zone ###
input buy = .05;
def buyzone = (open + buy);
plot hitBuyZone = close >= buyzone;
hitBuyZone.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
hitBuyZone.setDefaultColor( Color.ORANGE );
def count = if hitBuyZone then count[1] + 1 else count[1];
AddLabel (yes, " BUY COUNT: " + count + " ", Color.YELLOW );
def pct = Round(count / highestBar) * 100;
AddLabel (yes, " BuyZone %: " + (pct) + " ", Color.YELLOW );
### sell zone ###
input Sell = .50;
def sellzone = (open + Sell);
plot hitSellZone = close >= sellzone;
hitSellZone.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
hitSellZone.SetDefaultColor( Color.GREEN );
def countsells = if hitSellZone then countsells[1] + 1 else countsells[1];
AddLabel (yes, " SELL COUNT: " + (countsells) + " ", Color.YELLOW );
def pct2 = Round (countsells / highestBar) * 100;
AddLabel (yes, " SellZone %: " + (pct2) + " ", Color.YELLOW );
### percent of buy count that made it to the full buyzone cents ###
def pctOfBuyCount = Round (countsells / count) * 100;
AddLabel (yes, " Buy Count % of Sell Count: " + (pctOfBuyCount) + " ", Color.YELLOW );
### show bar count ###
AddLabel(BarNumber() == highestBar, " Bars Counted for %: " + BarNumber() + " ", Color.ORANGE);https://stackoverflow.com/questions/66232117
复制相似问题