YungTraderFromMontana
Well-known member
Can I have the code for the diminus diplus study.@Craighaber71
1. Price above cloud (Ichimoku)
2. d+ is greater than d- (Holy grail)
3. ROC is going up
4. FE - Yellow is going down
edit: got it above.
Can I have the code for the diminus diplus study.@Craighaber71
1. Price above cloud (Ichimoku)
2. d+ is greater than d- (Holy grail)
3. ROC is going up
4. FE - Yellow is going down
yes I apply the same one. You posted it before as well. Its weird I dont get the same one. Thanks for replying anyway@AKYN -
Are you using this scan from YT:
input LookbackPeriod = 3;
input TimeFrame2 = "1 hour";
input TimeFrame3 = "1 hour";
input HideSwings = no;
input HideCurrentTF = no;
input HideTimeFrame2 = no;
input HideTimeFrame3 = no;
input length = 5;
input length21 = 40;
input length1 = 5;
def price = close;
input lengthmo = 8;
input lengthsqu = 4;#hint length: Length for average calculation
def price23 = (open + close)/2;
input SDmult = 2.5;
input ATRmult = 1.0;
def K = (Highest(high, lengthmo) + Lowest(low, lengthmo)) /
2 + ExpAverage(close, lengthmo);
def Momo = Inertia(price23 - K / 2, lengthmo);
def SD = StDev(close, lengthsqu);
def Avg = ExpAverage(close, lengthsqu);
def ATR = Average(TrueRange(high, close, low), lengthsqu);
def SDup = Avg + (SDmult * SD);
def ATRup = Avg + (ATRmult * ATR);
def Squeeze = SDup < ATRup;
def squeezechange = (squeeze[1]) and (squeeze is false);
def upper = (momo > 0) and (momo > momo[1]);
def lower = (momo < 0) and (momo < momo[1]);
def swtichtup = (upper) and (squeezechange or squeezechange[1]);
def swtichtdown = (lower) and (squeezechange or squeezechange[1]);
def fullthrustup = (momo[1] < 0) and (momo > 0);
def fullthrustdown = (momo[1] > 0) and (momo < 0);
def recentup = swtichtup[1] or swtichtup or fullthrustup or fullthrustup[1];
def recentdown = swtichtdown[1] or swtichtdown or fullthrustdown or fullthrustdown[1];
def SwingsLagBar = 1;
def BuyEntry = 3;
def SellEntry = 3;
def QB = Highest(high, BuyEntry);
def QS = Lowest(low, SellEntry);
def trueqb = QB[1];
def trueqs = QS[1];
def midline = (trueqb + trueqs)/2;
def length78 = 1;
def displace = 0;
def price2 = close;
def SMA = Average(price[-displace], length78);
def SMA2 = Average(price2[-displace], length78);
#--------------------------------------------------------------
def _highInPeriod1 = Highest(high, LookbackPeriod);
def _lowInPeriod1 = Lowest(low, LookbackPeriod);
#--------------------------------------------------------------
def marketLow1 = if _lowInPeriod1 < _lowInPeriod1[-LookbackPeriod] then _lowInPeriod1 else _lowInPeriod1[-LookbackPeriod];
def _markedLow1 = low == marketLow1;
rec _lastMarkedLow1 = CompoundValue(1, if IsNaN(_markedLow1) then _lastMarkedLow1[1] else if _markedLow1 then low else _lastMarkedLow1[1], low);
#--------------------------------------------------------------
def marketHigh1 = if _highInPeriod1 > _highInPeriod1[-LookbackPeriod] then _highInPeriod1 else _highInPeriod1[-LookbackPeriod];
def _markedHigh1 = high == marketHigh1;
rec _lastMarkedHigh1 = CompoundValue(1, if IsNaN(_markedHigh1) then _lastMarkedHigh1[1] else if _markedHigh1 then high else _lastMarkedHigh1[1], high);
#--------------------------------------------------------------
def Resistance1 = _lastMarkedHigh1;
def Support1 = _lastMarkedLow1;
#--------------------------------------------------------------
def LowSwingForw = Lowest(low, SwingsLagBar)[-SwingsLagBar];
def LowSwingBack = Lowest(low, LookbackPeriod)[1];
def SwingLow = if low < LowSwingForw and low <= LowSwingBack then 1 else 0;
def LowSwing = if SwingLow then low else Double.NaN;
#--------------------------------------------------------------
def HighSwingForw = Highest(high, SwingsLagBar)[-SwingsLagBar];
def HighSwingBack = Highest(high, LookbackPeriod)[1];
def SwingHigh = if high > HighSwingForw and high >= HighSwingBack then 1 else 0;
def HighSwing = if SwingHigh then high else Double.NaN;
#--------------------------------------------------------------
def _highInPeriod2 = Highest(high(period = TimeFrame2), LookbackPeriod);
def _lowInPeriod2 = Lowest(low(period = TimeFrame2), LookbackPeriod);
#--------------------------------------------------------------
def marketLow2 = if _lowInPeriod2 < _lowInPeriod2[-LookbackPeriod] then _lowInPeriod2 else _lowInPeriod2[-LookbackPeriod];
def _markedLow2 = low(period = TimeFrame2) == marketLow2;
rec _lastMarkedLow2 = CompoundValue(1, if IsNaN(_markedLow2) then _lastMarkedLow2[1] else if _markedLow2 then low(period = TimeFrame2) else _lastMarkedLow2[1], low(period = TimeFrame2));
#--------------------------------------------------------------
def marketHigh2 = if _highInPeriod2 > _highInPeriod2[-LookbackPeriod] then _highInPeriod2 else _highInPeriod2[-LookbackPeriod];
def _markedHigh2 = high(period = TimeFrame2) == marketHigh2;
rec _lastMarkedHigh2 = CompoundValue(1, if IsNaN(_markedHigh2) then _lastMarkedHigh2[1] else if _markedHigh2 then high(period = TimeFrame2) else _lastMarkedHigh2[1], high(period = TimeFrame2));
#--------------------------------------------------------------
def Resistance2 = _lastMarkedHigh2;
def Support2 = _lastMarkedLow2;
#--------------------------------------------------------------
def _highInPeriod3 = Highest(high(period = TimeFrame3), LookbackPeriod);
def _lowInPeriod3 = Lowest(low(period = TimeFrame3), LookbackPeriod);
#--------------------------------------------------------------
def marketLow3 = if _lowInPeriod3 < _lowInPeriod3[-LookbackPeriod] then _lowInPeriod3 else _lowInPeriod3[-LookbackPeriod];
def _markedLow3 = low(period = TimeFrame3) == marketLow3;
rec _lastMarkedLow3 = CompoundValue(1, if IsNaN(_markedLow3) then _lastMarkedLow3[1] else if _markedLow3 then low(period = TimeFrame3) else _lastMarkedLow3[1], low(period = TimeFrame3));
#--------------------------------------------------------------
def marketHigh3 = if _highInPeriod3 > _highInPeriod3[-LookbackPeriod] then _highInPeriod3 else _highInPeriod3[-LookbackPeriod];
def _markedHigh3 = high(period = TimeFrame3) == marketHigh3;
rec _lastMarkedHigh3 = CompoundValue(1, if IsNaN(_markedHigh3) then _lastMarkedHigh3[1] else if _markedHigh3 then high(period = TimeFrame3) else _lastMarkedHigh3[1], high(period = TimeFrame3));
#--------------------------------------------------------------
def Resistance3 = _lastMarkedHigh3;
def Support3 = _lastMarkedLow3;
def ff = (open * 2 + close * 3)/5;
def lower_close1 = (SMA2 crosses below Support1[1]);
def higher_close1 = (SMA2 crosses above Resistance1[1]);
def lower_close2 = (SMA2 crosses below Support2[1]);
def higher_close2 = (SMA2 crosses above Resistance2[1]);
def lower_close3 = (SMA2 crosses below Support2[1]);
def higher_close3 = (SMA2 crosses above Resistance2[1]);
def higher_close12 = (ff > Resistance1[1]);
def higher_close22 = (ff > Resistance2[1]);
def higher_close32 = (ff > Resistance2[1]);
def x = (close > trueqb);
def c = (close[1] < trueqb[1]);
def v = (close[2] < trueqb[2]);
def b = x and (c or v);
def y = (close > trueqs);
def w = (close[1] < trueqs[1]);
def e = (close[2] < trueqs[2]);
def r = y and (w or e);
def allbreakdown = lower_close1 or lower_close2 or lower_close3;
def allbreakup = (higher_close1 or higher_close2 or higher_close3);
def allbreakup2 = (higher_close12 or higher_close22 or higher_close32);
def anyres = support1 or support2 or support3;
def ansup = support1 or support2 or support3;
input BuyEntry2 = 40;
input SellEntry2 = 40;
def QB2 = Highest(high, BuyEntry2);
def QS2 = Lowest(low, SellEntry2);
def trueqb2 = QB2[1];
def trueqs2 = QS2[1];
def midline2 = (trueqb2 + trueqs2)/2;
def fg = (high - close) < ((close - open) * 2);
def fgbear = (close-low) < ((open - close) * 2);
def goodcandle = ((high - close) < (hl2 - low)) or (open > high[1]);
def goodsellcandle = (close - low) < (high - hl2);
def goodcandle2 = ((close - open)/(high - low)) > .82;
def allbreaku = (allbreakup2 and goodcandle2);
def openhigh = open > close[1];
def goldenbuy = (allbreakup or allbreaku or allbreakup[1]);
def goldenshort = (allbreakdown);
plot goldenbuytesting = (goldenbuy or goldenbuy[1]) and recentup and (goodcandle) and (fg) and (squeeze is false);
#plot goldenshorttesting = (goldenshort) and recentdown and (squeeze is false) and fgbear;
I use a double bracket with trg fills and I set one stop at the resistance where the breakout occurred and the other like 3% below as a safety stop on the extreme off chance the other one doesn't get filled(This has never happened to me before.), then I set two take profits at the 2 next key resistance levels I see. Usually I'll do 3/4's of shares on the first and 1/4 of shares on the second, it changes based on how far these levels are from eachother but I'll always have a higher ratio on the closer resistance. In some cases if the stock is at ath or atl I'll use a regular trailing stop which the trail will greatly vary based on the stock and then use the second stop on the resistance line where the breakout occurred. I then disable the limit order side and it will sell when the trailing stop is hit. I use this strategy on 95% of my trades. These kind of trades I will do in mass over the course of a week(5-20) and not touch them. I have a plan in place with my orders and I don't mess with it.Do you use OCO orders or trailing stops. I had one losing trade out of 10 due to a stop loss that was set too tight. I normally use a 1.5 ATR but went against my trading plan due to not wanting to hold over the weekend. Looking forward to you daily setups.
input length = 10;
input smoothingLength = 5;
def diff = close - close[length - 1];
def val = 100 * Sqrt(Sqr(diff) + Sqr(length)) / sum(Sqrt(1 + Sqr(close - close[1])), length - 1);
def PFE = ExpAverage(if diff > 0 then val else -val, smoothingLength);
plot pfediv = ((pfe/100) + 1.2) * .4;
The day of the trade was 4/5. I used one gamma line and it showed signs of a breakout. I also saw extremely bullish option flow and their was a massive reaction in the market. I accumulated shares on the day of the signal once in pre market and a second time at 3 est. Stop is always on the resistance line and my limits were at around 81 and 100.Risk management here is superb. Good work, super helpful to us newbies as well. I personally use the 200 and 50 sma (on 1d 4h 1h 30m 15m 5m) as price levels but I intraday trade.
Your second strategy seems to be promising, would you mind sharing the reason for you entry on the SHOP and W?
Lastly, I want to ask how you got started on thinkscript and how you would recommend a newcomer to learn.
The day of the trade was 4/5. I used one gamma line and it showed signs of a breakout. I also saw extremely bullish option flow and their was a massive reaction in the market. I accumulated shares on the day of the signal once in pre market and a second time at 3 est. Stop is always on the resistance line and my limits were at around 81 and 100.
Here is shop, I took the trade for many similar reasons. I entered at 3 est on 4/13 and at open on 4/14. My stop was the breakout line my limits were 513 and 569.
#Programmatic_SupportResistance_WickZoneMod
declare upper;
input LookbackPeriod = 5;
input HideCurrentTF = no;
input HideTimeFrame2 = no;
input HideTimeFrame3 = no;
input TimeFrame2 = {default "15 MIN", "1 MIN", "2 MIN", "3 MIN", "4 MIN", "5 MIN", "10 MIN", "20 MIN", "30 MIN", "1 HOUR", "2 HOURS", "4 HOURS", DAY, "2 DAYS", "3 DAYS", "4 DAYS", WEEK, MONTH, "OPT EXP"};
input TimeFrame3 = {"30 MIN", "1 MIN", "2 MIN", "3 MIN", "4 MIN", "5 MIN", "10 MIN", "15 MIN", "20 MIN",default "1 HOUR", "2 HOURS", "4 HOURS", DAY, "2 DAYS", "3 DAYS", "4 DAYS", WEEK, MONTH, "OPT EXP"};
input HideSwings = no;
input SwingsLagBar = 1;
#--------------------------------------------------------------
def _highInPeriod1 = Highest(high, LookbackPeriod);
def _lowInPeriod1 = Lowest(low, LookbackPeriod);
#--------------------------------------------------------------
def marketLow1 = if _lowInPeriod1 < _lowInPeriod1[-LookbackPeriod] then _lowInPeriod1 else _lowInPeriod1[-LookbackPeriod];
def _markedLow1 = low == marketLow1;
rec _lastMarkedLow1 = CompoundValue(1, if IsNaN(_markedLow1) then _lastMarkedLow1[1] else if _markedLow1 then low else _lastMarkedLow1[1], low);
rec _lastMarkedLow11 = CompoundValue(1, if IsNaN(_markedLow1) then _lastMarkedLow11[1] else if _markedLow1 then Min(open, close) else _lastMarkedLow11[1], low);
#--------------------------------------------------------------
def marketHigh1 = if _highInPeriod1 > _highInPeriod1[-LookbackPeriod] then _highInPeriod1 else _highInPeriod1[-LookbackPeriod];
def _markedHigh1 = high == marketHigh1;
rec _lastMarkedHigh1 = CompoundValue(1, if IsNaN(_markedHigh1) then _lastMarkedHigh1[1] else if _markedHigh1 then high else _lastMarkedHigh1[1], high);
rec _lastMarkedHigh11 = CompoundValue(1, if IsNaN(_markedHigh1) then _lastMarkedHigh11[1] else if _markedHigh1 then Max(open, close) else _lastMarkedHigh11[1], high);
#--------------------------------------------------------------
plot Resistance1 = _lastMarkedHigh1;
plot Resistance11 = _lastMarkedHigh11;
plot Support1 = _lastMarkedLow1;
plot Support11 = _lastMarkedLow11;
#--------------------------------------------------------------
Resistance11.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Resistance11.SetDefaultColor(Color.MAGENTA);
Resistance11.SetHiding(HideCurrentTF);
Resistance1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Resistance1.SetDefaultColor(Color.MAGENTA);
Resistance1.SetHiding(HideCurrentTF);
AddCloud(Resistance1, Resistance11, Color.MAGENTA, Color.MAGENTA);
#--------------------------------------------------------------
Support1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Support1.SetDefaultColor(Color.YELLOW);
Support1.SetHiding(HideCurrentTF);
Support11.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Support11.SetDefaultColor(Color.YELLOW);
Support11.SetHiding(HideCurrentTF);
AddCloud(Support1, Support11, Color.YELLOW, Color.YELLOW);
#--------------------------------------------------------------
def LowSwingForw = Lowest(low, SwingsLagBar)[-SwingsLagBar];
def LowSwingBack = Lowest(low, LookbackPeriod)[1];
def SwingLow = if low < LowSwingForw and low <= LowSwingBack then 1 else 0;
plot LowSwing = if SwingLow then low else Double.NaN;
LowSwing.Hide();
#--------------------------------------------------------------
def HighSwingForw = Highest(high, SwingsLagBar)[-SwingsLagBar];
def HighSwingBack = Highest(high, LookbackPeriod)[1];
def SwingHigh = if high > HighSwingForw and high >= HighSwingBack then 1 else 0;
plot HighSwing = if SwingHigh then high else Double.NaN;
HighSwing.Hide();
#--------------------------------------------------------------
HighSwing.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
HighSwing.SetLineWeight(5);
HighSwing.SetDefaultColor(Color.MAGENTA);
HighSwing.SetHiding(HideSwings);
LowSwing.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
LowSwing.SetLineWeight(5);
LowSwing.SetDefaultColor(Color.YELLOW);
LowSwing.SetHiding(HideSwings);
#--------------------------------------------------------------
Alert(HighSwing, "SupRes : Swing High", Alert.BAR, Sound.Bell);
Alert(LowSwing, "SupRes : Swing Low", Alert.BAR, Sound.Bell);
#--------------------------------------------------------------
AddLabel(HighSwing, "SupRes : Swing High", Color.MAGENTA);
AddLabel(LowSwing, "SupRes : Swing Low", Color.YELLOW);
#--------------------------------------------------------------
def _highInPeriod2 = Highest(high(period = TimeFrame2), LookbackPeriod);
def _lowInPeriod2 = Lowest(low(period = TimeFrame2), LookbackPeriod);
#--------------------------------------------------------------
def marketLow2 = if _lowInPeriod2 < _lowInPeriod2[-LookbackPeriod] then _lowInPeriod2 else _lowInPeriod2[-LookbackPeriod];
def _markedLow2 = low(period = TimeFrame2) == marketLow2;
rec _lastMarkedLow2 = CompoundValue(1, if IsNaN(_markedLow2) then _lastMarkedLow2[1] else if _markedLow2 then low(period = TimeFrame2) else _lastMarkedLow2[1], low(period = TimeFrame2));
rec _lastMarkedLow22 = CompoundValue(1, if IsNaN(_markedLow2) then _lastMarkedLow22[1] else if _markedLow2 then Min(open, close(period = TimeFrame2)) else _lastMarkedLow22[1], low(period = TimeFrame2));
#--------------------------------------------------------------
def marketHigh2 = if _highInPeriod2 > _highInPeriod2[-LookbackPeriod] then _highInPeriod2 else _highInPeriod2[-LookbackPeriod];
def _markedHigh2 = high(period = TimeFrame2) == marketHigh2;
rec _lastMarkedHigh2 = CompoundValue(1, if IsNaN(_markedHigh2) then _lastMarkedHigh2[1] else if _markedHigh2 then high(period = TimeFrame2) else _lastMarkedHigh2[1], high(period = TimeFrame2));
rec _lastMarkedHigh22 = CompoundValue(1, if IsNaN(_markedHigh2) then _lastMarkedHigh22[1] else if _markedHigh2 then Max(open, close(period = TimeFrame2)) else _lastMarkedHigh22[1], high(period = TimeFrame2));
#--------------------------------------------------------------
plot Resistance2 = _lastMarkedHigh2;
plot Resistance22 = _lastMarkedHigh22;
plot Support2 = _lastMarkedLow2;
plot Support22 = _lastMarkedLow22;
#--------------------------------------------------------------
Resistance2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Resistance2.SetDefaultColor(Color.PINK);
Resistance2.SetHiding(HideTimeFrame2);
Resistance22.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Resistance22.SetDefaultColor(Color.PINK);
Resistance22.SetHiding(HideTimeFrame2);
AddCloud(Resistance2, Resistance22, Color.PINK, Color.PINK);
#--------------------------------------------------------------
Support2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Support2.SetDefaultColor(Color.ORANGE);
Support2.SetHiding(HideTimeFrame2);
Support22.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Support22.SetDefaultColor(Color.ORANGE);
Support22.SetHiding(HideTimeFrame2);
AddCloud(Support2, Support22, Color.ORANGE, Color.ORANGE);
#--------------------------------------------------------------
def _highInPeriod3 = Highest(high(period = TimeFrame3), LookbackPeriod);
def _lowInPeriod3 = Lowest(low(period = TimeFrame3), LookbackPeriod);
#--------------------------------------------------------------
def marketLow3 = if _lowInPeriod3 < _lowInPeriod3[-LookbackPeriod] then _lowInPeriod3 else _lowInPeriod3[-LookbackPeriod];
def _markedLow3 = low(period = TimeFrame3) == marketLow3;
rec _lastMarkedLow3 = CompoundValue(1, if IsNaN(_markedLow3) then _lastMarkedLow3[1] else if _markedLow3 then low(period = TimeFrame3) else _lastMarkedLow3[1], low(period = TimeFrame3));
rec _lastMarkedLow33 = CompoundValue(1, if IsNaN(_markedLow3) then _lastMarkedLow33[1] else if _markedLow3 then Min(open, close(period = TimeFrame3)) else _lastMarkedLow33[1], low(period = TimeFrame3));
#--------------------------------------------------------------
def marketHigh3 = if _highInPeriod3 > _highInPeriod3[-LookbackPeriod] then _highInPeriod3 else _highInPeriod3[-LookbackPeriod];
def _markedHigh3 = high(period = TimeFrame3) == marketHigh3;
rec _lastMarkedHigh3 = CompoundValue(1, if IsNaN(_markedHigh3) then _lastMarkedHigh3[1] else if _markedHigh3 then high(period = TimeFrame3) else _lastMarkedHigh3[1], high(period = TimeFrame3));
rec _lastMarkedHigh33 = CompoundValue(1, if IsNaN(_markedHigh3) then _lastMarkedHigh33[1] else if _markedHigh3 then Max(open, close(period = TimeFrame3)) else _lastMarkedHigh33[1], high(period = TimeFrame3));
#--------------------------------------------------------------
plot Resistance3 = _lastMarkedHigh3;
plot Resistance33 = _lastMarkedHigh33;
plot Support3 = _lastMarkedLow3;
plot Support33 = _lastMarkedLow33;
#--------------------------------------------------------------
Resistance3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Resistance3.SetDefaultColor(Color.PLUM);
Resistance3.SetHiding(HideTimeFrame3);
Resistance33.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Resistance33.SetDefaultColor(Color.PLUM);
Resistance33.SetHiding(HideTimeFrame3);
AddCloud(Resistance3, Resistance33, Color.PLUM, Color.PLUM);
#--------------------------------------------------------------
Support3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Support3.SetDefaultColor(Color.DARK_ORANGE);
Support3.SetHiding(HideTimeFrame3);
Support33.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Support33.SetDefaultColor(Color.DARK_ORANGE);
Support33.SetHiding(HideTimeFrame3);
AddCloud(Support3, Support33, Color.DARK_ORANGE, Color.DARK_ORANGE);
How did u get cloud on support and resistance?
Add this and match your settings to the other one.Code:#Programmatic_SupportResistance_WickZoneMod declare upper; input LookbackPeriod = 5; input HideCurrentTF = no; input HideTimeFrame2 = no; input HideTimeFrame3 = no; input TimeFrame2 = {default "15 MIN", "1 MIN", "2 MIN", "3 MIN", "4 MIN", "5 MIN", "10 MIN", "20 MIN", "30 MIN", "1 HOUR", "2 HOURS", "4 HOURS", DAY, "2 DAYS", "3 DAYS", "4 DAYS", WEEK, MONTH, "OPT EXP"}; input TimeFrame3 = {"30 MIN", "1 MIN", "2 MIN", "3 MIN", "4 MIN", "5 MIN", "10 MIN", "15 MIN", "20 MIN",default "1 HOUR", "2 HOURS", "4 HOURS", DAY, "2 DAYS", "3 DAYS", "4 DAYS", WEEK, MONTH, "OPT EXP"}; input HideSwings = no; input SwingsLagBar = 1; #-------------------------------------------------------------- def _highInPeriod1 = Highest(high, LookbackPeriod); def _lowInPeriod1 = Lowest(low, LookbackPeriod); #-------------------------------------------------------------- def marketLow1 = if _lowInPeriod1 < _lowInPeriod1[-LookbackPeriod] then _lowInPeriod1 else _lowInPeriod1[-LookbackPeriod]; def _markedLow1 = low == marketLow1; rec _lastMarkedLow1 = CompoundValue(1, if IsNaN(_markedLow1) then _lastMarkedLow1[1] else if _markedLow1 then low else _lastMarkedLow1[1], low); rec _lastMarkedLow11 = CompoundValue(1, if IsNaN(_markedLow1) then _lastMarkedLow11[1] else if _markedLow1 then Min(open, close) else _lastMarkedLow11[1], low); #-------------------------------------------------------------- def marketHigh1 = if _highInPeriod1 > _highInPeriod1[-LookbackPeriod] then _highInPeriod1 else _highInPeriod1[-LookbackPeriod]; def _markedHigh1 = high == marketHigh1; rec _lastMarkedHigh1 = CompoundValue(1, if IsNaN(_markedHigh1) then _lastMarkedHigh1[1] else if _markedHigh1 then high else _lastMarkedHigh1[1], high); rec _lastMarkedHigh11 = CompoundValue(1, if IsNaN(_markedHigh1) then _lastMarkedHigh11[1] else if _markedHigh1 then Max(open, close) else _lastMarkedHigh11[1], high); #-------------------------------------------------------------- plot Resistance1 = _lastMarkedHigh1; plot Resistance11 = _lastMarkedHigh11; plot Support1 = _lastMarkedLow1; plot Support11 = _lastMarkedLow11; #-------------------------------------------------------------- Resistance11.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); Resistance11.SetDefaultColor(Color.MAGENTA); Resistance11.SetHiding(HideCurrentTF); Resistance1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); Resistance1.SetDefaultColor(Color.MAGENTA); Resistance1.SetHiding(HideCurrentTF); AddCloud(Resistance1, Resistance11, Color.MAGENTA, Color.MAGENTA); #-------------------------------------------------------------- Support1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); Support1.SetDefaultColor(Color.YELLOW); Support1.SetHiding(HideCurrentTF); Support11.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); Support11.SetDefaultColor(Color.YELLOW); Support11.SetHiding(HideCurrentTF); AddCloud(Support1, Support11, Color.YELLOW, Color.YELLOW); #-------------------------------------------------------------- def LowSwingForw = Lowest(low, SwingsLagBar)[-SwingsLagBar]; def LowSwingBack = Lowest(low, LookbackPeriod)[1]; def SwingLow = if low < LowSwingForw and low <= LowSwingBack then 1 else 0; plot LowSwing = if SwingLow then low else Double.NaN; LowSwing.Hide(); #-------------------------------------------------------------- def HighSwingForw = Highest(high, SwingsLagBar)[-SwingsLagBar]; def HighSwingBack = Highest(high, LookbackPeriod)[1]; def SwingHigh = if high > HighSwingForw and high >= HighSwingBack then 1 else 0; plot HighSwing = if SwingHigh then high else Double.NaN; HighSwing.Hide(); #-------------------------------------------------------------- HighSwing.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); HighSwing.SetLineWeight(5); HighSwing.SetDefaultColor(Color.MAGENTA); HighSwing.SetHiding(HideSwings); LowSwing.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); LowSwing.SetLineWeight(5); LowSwing.SetDefaultColor(Color.YELLOW); LowSwing.SetHiding(HideSwings); #-------------------------------------------------------------- Alert(HighSwing, "SupRes : Swing High", Alert.BAR, Sound.Bell); Alert(LowSwing, "SupRes : Swing Low", Alert.BAR, Sound.Bell); #-------------------------------------------------------------- AddLabel(HighSwing, "SupRes : Swing High", Color.MAGENTA); AddLabel(LowSwing, "SupRes : Swing Low", Color.YELLOW); #-------------------------------------------------------------- def _highInPeriod2 = Highest(high(period = TimeFrame2), LookbackPeriod); def _lowInPeriod2 = Lowest(low(period = TimeFrame2), LookbackPeriod); #-------------------------------------------------------------- def marketLow2 = if _lowInPeriod2 < _lowInPeriod2[-LookbackPeriod] then _lowInPeriod2 else _lowInPeriod2[-LookbackPeriod]; def _markedLow2 = low(period = TimeFrame2) == marketLow2; rec _lastMarkedLow2 = CompoundValue(1, if IsNaN(_markedLow2) then _lastMarkedLow2[1] else if _markedLow2 then low(period = TimeFrame2) else _lastMarkedLow2[1], low(period = TimeFrame2)); rec _lastMarkedLow22 = CompoundValue(1, if IsNaN(_markedLow2) then _lastMarkedLow22[1] else if _markedLow2 then Min(open, close(period = TimeFrame2)) else _lastMarkedLow22[1], low(period = TimeFrame2)); #-------------------------------------------------------------- def marketHigh2 = if _highInPeriod2 > _highInPeriod2[-LookbackPeriod] then _highInPeriod2 else _highInPeriod2[-LookbackPeriod]; def _markedHigh2 = high(period = TimeFrame2) == marketHigh2; rec _lastMarkedHigh2 = CompoundValue(1, if IsNaN(_markedHigh2) then _lastMarkedHigh2[1] else if _markedHigh2 then high(period = TimeFrame2) else _lastMarkedHigh2[1], high(period = TimeFrame2)); rec _lastMarkedHigh22 = CompoundValue(1, if IsNaN(_markedHigh2) then _lastMarkedHigh22[1] else if _markedHigh2 then Max(open, close(period = TimeFrame2)) else _lastMarkedHigh22[1], high(period = TimeFrame2)); #-------------------------------------------------------------- plot Resistance2 = _lastMarkedHigh2; plot Resistance22 = _lastMarkedHigh22; plot Support2 = _lastMarkedLow2; plot Support22 = _lastMarkedLow22; #-------------------------------------------------------------- Resistance2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); Resistance2.SetDefaultColor(Color.PINK); Resistance2.SetHiding(HideTimeFrame2); Resistance22.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); Resistance22.SetDefaultColor(Color.PINK); Resistance22.SetHiding(HideTimeFrame2); AddCloud(Resistance2, Resistance22, Color.PINK, Color.PINK); #-------------------------------------------------------------- Support2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); Support2.SetDefaultColor(Color.ORANGE); Support2.SetHiding(HideTimeFrame2); Support22.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); Support22.SetDefaultColor(Color.ORANGE); Support22.SetHiding(HideTimeFrame2); AddCloud(Support2, Support22, Color.ORANGE, Color.ORANGE); #-------------------------------------------------------------- def _highInPeriod3 = Highest(high(period = TimeFrame3), LookbackPeriod); def _lowInPeriod3 = Lowest(low(period = TimeFrame3), LookbackPeriod); #-------------------------------------------------------------- def marketLow3 = if _lowInPeriod3 < _lowInPeriod3[-LookbackPeriod] then _lowInPeriod3 else _lowInPeriod3[-LookbackPeriod]; def _markedLow3 = low(period = TimeFrame3) == marketLow3; rec _lastMarkedLow3 = CompoundValue(1, if IsNaN(_markedLow3) then _lastMarkedLow3[1] else if _markedLow3 then low(period = TimeFrame3) else _lastMarkedLow3[1], low(period = TimeFrame3)); rec _lastMarkedLow33 = CompoundValue(1, if IsNaN(_markedLow3) then _lastMarkedLow33[1] else if _markedLow3 then Min(open, close(period = TimeFrame3)) else _lastMarkedLow33[1], low(period = TimeFrame3)); #-------------------------------------------------------------- def marketHigh3 = if _highInPeriod3 > _highInPeriod3[-LookbackPeriod] then _highInPeriod3 else _highInPeriod3[-LookbackPeriod]; def _markedHigh3 = high(period = TimeFrame3) == marketHigh3; rec _lastMarkedHigh3 = CompoundValue(1, if IsNaN(_markedHigh3) then _lastMarkedHigh3[1] else if _markedHigh3 then high(period = TimeFrame3) else _lastMarkedHigh3[1], high(period = TimeFrame3)); rec _lastMarkedHigh33 = CompoundValue(1, if IsNaN(_markedHigh3) then _lastMarkedHigh33[1] else if _markedHigh3 then Max(open, close(period = TimeFrame3)) else _lastMarkedHigh33[1], high(period = TimeFrame3)); #-------------------------------------------------------------- plot Resistance3 = _lastMarkedHigh3; plot Resistance33 = _lastMarkedHigh33; plot Support3 = _lastMarkedLow3; plot Support33 = _lastMarkedLow33; #-------------------------------------------------------------- Resistance3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); Resistance3.SetDefaultColor(Color.PLUM); Resistance3.SetHiding(HideTimeFrame3); Resistance33.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); Resistance33.SetDefaultColor(Color.PLUM); Resistance33.SetHiding(HideTimeFrame3); AddCloud(Resistance3, Resistance33, Color.PLUM, Color.PLUM); #-------------------------------------------------------------- Support3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); Support3.SetDefaultColor(Color.DARK_ORANGE); Support3.SetHiding(HideTimeFrame3); Support33.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); Support33.SetDefaultColor(Color.DARK_ORANGE); Support33.SetHiding(HideTimeFrame3); AddCloud(Support3, Support33, Color.DARK_ORANGE, Color.DARK_ORANGE);
Wondering why price is being hidden by all that stuff? I think I could see the arrows more clear on price without distractions, no?First off I thought the colors on the lower study would transfer but I guess they didn't. To accurately use the study color gamma2-5 dark yellow, gamma6-10 green, gamma 11-15 cyan, gamma 16-20 purpulish blue. I've found thse colors mix well together.
Here is a screeshot showing how to use it with this strategy on btc futures.
To take a trade you want either yellow to be leading down after it has been sparatic or all lines to be leading down. Arrows are where I would take trades, circled area is when I would avoid trading. Using fe will cause you to miss some breakouts but also massively increase your win rate.
Make sure you color code the gamma's or the study is useless.
Thanks...How do you read the ROC...Also do you have the holy grail script
Trying to set up an order entry template. I figured out the trailing stop, but how do you enter a two level profit. Do I need1 trig 2OCO? Could you screen shot an order entrty with the brackets in which you speak?I use a double bracket with trg fills and I set one stop at the resistance where the breakout occurred and the other like 3% below as a safety stop on the extreme off chance the other one doesn't get filled(This has never happened to me before.), then I set two take profits at the 2 next key resistance levels I see. Usually I'll do 3/4's of shares on the first and 1/4 of shares on the second, it changes based on how far these levels are from eachother but I'll always have a higher ratio on the closer resistance. In some cases if the stock is at ath or atl I'll use a regular trailing stop which the trail will greatly vary based on the stock and then use the second stop on the resistance line where the breakout occurred. I then disable the limit order side and it will sell when the trailing stop is hit. I use this strategy on 95% of my trades. These kind of trades I will do in mass over the course of a week(5-20) and not touch them. I have a plan in place with my orders and I don't mess with it.
The second strategy I use is when I have extreme confidence in trade, usually the trade size of these trades will be 10-15 times bigger. I often find myself doing this on average about once a week. I make sure I never have more then 2 of these trades open at once. On these trades I divert more of my attention, I will always set a stop on the resistance and a safety stop below it. The difference is I sell based on my own analysis which incorporates many things such as resistances, 200sma 50sma 20sma(not crossings just as price barriers), fe, and more.
This all leaves me with a consistent amount of trades running at once that I don't have to constantly monitor and saves me hours out of the day if I did otherwise. I can do all my work only using only a few hours every day. Often times on my second strategy when I take a break from the markets I'll set a stop order manually so I can do whatever I want to do without worrying.
I monitor the probabilities of all of my trades and these are the results I get that I will only be improving as I get better.
From strategy 1 the success rate is 39% and the average win is 2 times bigger then the average loss. This makes me about a 4/3 profit loss ratio. Essentially non compounded I can make 33.3% on the amount of money that I risk. But compounding should be your biggest friend. As long as you have a strategy with a solid plan and predictable results you should use every dollar you make to up your trade size after you take away the money you need for expenses unless you have other ways to address it. Non compounded with a risk of 30k every month you would make 10k a month or 120k a year. Compounded the new number is 310k on the 12th month or 31 times higher then the initial margin. Total accountsive would be 1.3 millions. This number would be astronomical after more years of these compounded returns however this is all hypothetical. Eventually you'll run into liquidity issues and more that make it tougher. Many of the best oppurtunities are often on small caps.
The sample size for my second strategy is smaller because I've only been doing this for a little over a month.
On the second strategy I have a 75% win rate and a astronomical average win almost 6 times bigger then the average loss. The win rate on this one may be sustainable but the average win was heavily boosted by W and SHOP trades. Still we'll see where it settles. If I could keep this up even though I know it's not mathematically possible I would make on average 425% on the amount that I risked.
I am confident that my success can continue and fortunately this strategy has a bright future as its still very new. I'm going to get everything down to a science that I can and fine tune it.
Thanks dude I was playing with numbers but never tried 10. It worked. Appreciated!@akykn try changing the BuyEntry and SellEntry to 10 and see if you see the arrows.
# TheoTrade RSI in Laguerre Time Self Adjusting With Fractal Energy
# Mobius
# V03.06.15.2016
# Both Fractal Energy and RSI are plotted. RSI in cyan and FE in yellow. Look for trend exhaustion in the FE and a reversal of RSI or Price compression in FE and an RSI reversal.
declare lower;
#Inputs:
input nfe1 = 1;
input nfe2 = 2;
input nfe3 = 3;
input nfe4 = 4;
input nfe5 = 5;
input nfe6 = 6;
input nfe7 = 7;
input nfe8 = 8;
input nfe9 = 9;
input nfe10 = 10;
input nfe11 = 11;
input nfe12 = 12;
input nfe13 = 13;
input nfe14 = 14;
input nfe15 = 15;
input nfe16 = 16;
input nfe17 = 17;
input nfe18 = 18;
input nfe19 = 19;
input nfe20 = 20;
input length = 10;
input smoothingLength = 5;
#FE polarity indicator
def diff = close - close[length - 1];
def val = 100 * Sqrt(Sqr(diff) + Sqr(length)) / sum(Sqrt(1 + Sqr(close - close[1])), length - 1);
def PFE = ExpAverage(if diff > 0 then val else -val, smoothingLength);
plot pfediv = ((pfe/100) + 1.2) * .4;
pfediv.setStyle(Curve.MEDIUM_DASH);
pfediv.setLineWeight(5);
pfediv.setDefaultColor(Color.DARK_ORANGE);
#hint nFE: length for Fractal Energy calculation.
# Variables:
def o;
def h;
def l;
def c;
# Calculations
o = (open + close[1]) / 2;
h = Max(high, close[1]);
l = Min(low, close[1]);
c = (o + h + l + close) / 4;
# Gamma Function
script gammax {
input nFEi = 12;
def FE = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFEi) /
(Highest(high, nFEi) - Lowest(low, nFEi)))
/ Log(nFEi);
plot gamma = FE;
}
plot gamma = gammax(nFE1); gamma.setDefaultColor(Color.CYAN);
plot gamma2 = gammax(nFE2); gamma2.setDefaultColor(Color.YELLOW); gamma2.setLineWeight(2);
plot gamma3 = gammax(nFE3); gamma3.setDefaultColor(Color.YELLOW); gamma3.setLineWeight(2);
plot gamma4 = gammax(nFE4); gamma4.setDefaultColor(Color.YELLOW); gamma4.setLineWeight(2);
plot gamma5 = gammax(nFE5); gamma5.setDefaultColor(Color.YELLOW); gamma5.setLineWeight(2);
plot gamma6 = gammax(nFE6); gamma6.setDefaultColor(Color.GREEN);
plot gamma7 = gammax(nFE7); gamma7.setDefaultColor(Color.GREEN);
plot gamma8 = gammax(nFE8); gamma8.setDefaultColor(Color.GREEN);
plot gamma9 = gammax(nFE9); gamma9.setDefaultColor(Color.GREEN);
plot gamma10 = gammax(nFE10); gamma10.setDefaultColor(Color.GREEN);
plot gamma11 = gammax(nFE11); gamma11.setDefaultColor(Color.CYAN);
plot gamma12 = gammax(nFE12); gamma12.setDefaultColor(Color.CYAN);
plot gamma13 = gammax(nFE13); gamma13.setDefaultColor(Color.CYAN);
plot gamma14 = gammax(nFE14); gamma14.setDefaultColor(Color.CYAN);
plot gamma15 = gammax(nFE15); gamma15.setDefaultColor(Color.CYAN);
plot gamma16 = gammax(nFE16); gamma16.setDefaultColor(Color.VIOLET);
plot gamma17 = gammax(nFE17); gamma17.setDefaultColor(Color.VIOLET);
plot gamma18 = gammax(nFE18); gamma18.setDefaultColor(Color.VIOLET);
plot gamma19 = gammax(nFE19); gamma19.setDefaultColor(Color.VIOLET);
plot gamma20 = gammax(nFE20); gamma20.setDefaultColor(Color.VIOLET);
plot gammasector1 = (gamma + gamma2 + gamma3 + gamma4 + gamma5)/5;
plot gammasector2 = (gamma6 + gamma7 + gamma8 + gamma9 + gamma10)/5;
plot gammasector3 = (gamma11 + gamma12 + gamma13 + gamma14 + gamma15)/5;
plot gammasector4 = (gamma16 + gamma17 + gamma18 + gamma19 + gamma20)/5;
yes but it helps with recognizing the highs and lows of the res and support.Wondering why price is being hidden by all that stuff? I think I could see the arrows more clear on price without distractions, no?
Guys dumb question? What does the ploarity mean in the FE indicatoryes but it helps with recognizing the highs and lows of the res and support.
You need to use 2 brackets. I just use active trader like you'll see in the picture. I create an order that will have stops and limits that the stock has no chance of setting off. Make it at least 2 percent off. Once I send the first order I manually adjust the stops and limits to the resistances. This will cancel your old stop and limit and replace it with where you dragged your order. For me at least it saves time and is more accurate then manually typing in the share price where the key levels areTrying to set up an order entry template. I figured out the trailing stop, but how do you enter a two level profit. Do I need1 trig 2OCO? Could you screen shot an order entrty with the brackets in which you speak?
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
YungTrader's Relative Volume | Indicators | 17 | ||
The Ultimate Buy and Sell Indicator for ThinkOrSwim | Indicators | 4 | ||
P | Ultimate MACD For ThinkOrSwim | Indicators | 16 | |
Ultimate RSI [LuxAlgo] for ThinkOrSwim | Indicators | 12 | ||
Ultimate Bullish Cross using Price Momentum and Volume For SwingTrading | Indicators | 26 |
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.