ORB For Mobile

hazmat8039

New member
I have this indicator for the ORB and i was wondering why this does not work on mobile, anway someone can tell me why? and possibly help me to convert it to be mobile friendly?

Code:
input openingRangeStartTimeEST = 930;
input openingRangeEndTimeEST = 1000;
def openingRange = if SecondsTillTime(openingRangeStartTimeEST) <= 0 and SecondsTillTime(openingRangeEndTimeEST) >= 0 then 1 else 0;

input entryType = {default wickTouch, closeAbove};

input tradeEntryStartTimeEST = 930;
input tradeEntryEndTimeEST = 1600;
def tradeEntryRange = if SecondsTillTime(tradeEntryStartTimeEST) <= 0 and SecondsTillTime(tradeEntryEndTimeEST) >= 0 then 1 else 0;

def openingRangeHigh = if SecondsTillTime(openingRangeStartTimeEST) == 0 then high else if openingRange and high > openingRangeHigh[1] then high else openingRangeHigh[1];
def openingRangeLow = if SecondsTillTime(openingRangeStartTimeEST) == 0 then low else if openingRange and low < openingRangeLow[1] then low else openingRangeLow[1];

plot tradeEntryHighExtension = if tradeEntryRange then openingRangeHigh else double.nan;
plot tradeEntryLowExtension = if tradeEntryRange then openingRangeLow else double.nan;

tradeEntryHighExtension.setPaintingStrategy(PaintingStrategy.Horizontal);
tradeEntryLowExtension.setPaintingStrategy(PaintingStrategy.Horizontal);

tradeEntryHighExtension.setStyle(Curve.FIRM);
tradeEntryLowExtension.setStyle(Curve.FIRM);

tradeEntryHighExtension.setDefaultColor(Color.CYAN);
tradeEntryLowExtension.setDefaultColor(Color.CYAN);

def bullEntryCondition;
def bearEntryCondition;

switch(entryType){
case wickTouch:
    bullEntryCondition = tradeEntryRange and high > openingRangeHigh and high[1] <= openingRangeHigh;
    bearEntryCondition = tradeEntryRange and low < openingRangeLow and low[1] >= openingRangeLow;
case closeAbove:
    bullEntryCondition = tradeEntryRange and close > openingRangeHigh and close[1] <= openingRangeHigh;
    bearEntryCondition = tradeEntryRange and close < openingRangeLow and close[1] >= openingRangeLow;
}

def bullishORB = if bullEntryCondition then 1 else if !tradeEntryRange then 0 else bullishORB[1];
def bearishORB = if bearEntryCondition then 1 else if !tradeEntryRange then 0 else bearishORB[1];

def range = openingRangeHigh - OpeningRangeLow;
def halfRange = range / 2;
def midRange = openingRangeLow + halfRange;

plot midRangePlot = if tradeEntryRange then midRange else double.nan;
midRangePlot.setPaintingStrategy(PaintingStrategy.Horizontal);
midRangePlot.setStyle(Curve.Short_Dash);
midRangePlot.setDefaultColor(Color.VIOLET);

#-------------------------

def P1 = openingRangehigh + halfRange;
plot P1Plot = if bullishORB and tradeEntryRange then P1 else double.nan;
P1Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P1Plot.setDefaultColor(Color.Light_Green);

#-------------------------

def P2 = openingRangehigh + range;
plot P2Plot = if bullishORB and tradeEntryRange then P2 else double.nan;
P2Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P2Plot.setDefaultColor(Color.Light_Green);

#-----------------------------------
def P3 = openingRangehigh + range + halfrange;
plot P3Plot = if bullishORB and tradeEntryRange then P3 else double.nan;
P3Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P3Plot.setDefaultColor(Color.Green);

#-----------------------------------


def P4 = openingRangehigh + range + range;
plot P4Plot = if bullishORB and tradeEntryRange then P4 else double.nan;
P4Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P4Plot.setDefaultColor(Color.Green);


#-----------------------------------

def P5 = openingRangehigh + range + range + halfrange;
plot P5Plot = if bullishORB and tradeEntryRange then P5 else double.nan;
P5Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P5Plot.setDefaultColor(Color.Green);



#------------------------------------

def P6 = openingRangehigh + range + range + range;
plot P6Plot = if bullishORB and tradeEntryRange then P6 else double.nan;
P6Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P6Plot.setDefaultColor(Color.DARK_Green);



#------------------------------------

def P7 = openingRangehigh + range + range + range + halfRange;
plot P7Plot = if bullishORB and tradeEntryRange then P7 else double.nan;
P7Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P7Plot.setDefaultColor(Color.DARK_Green);



#-----------------------------------

def P8 = openingRangehigh + range + range + range + range;
plot P8Plot = if bullishORB and tradeEntryRange then P8 else double.nan;
P8Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P8Plot.setDefaultColor(Color.DARK_Green);


#-----------------------------------


def D1 = openingRangelow - halfRange;
plot D1Plot = if bearishORB and tradeEntryRange then D1 else double.nan;
D1Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D1Plot.setDefaultColor(Color.ORANGE);

#---------------------------------
def D2 = openingRangelow - range;
plot D2Plot = if bearishORB and tradeEntryRange then D2 else double.nan;
D2Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D2Plot.setDefaultColor(Color.ORANGE);
#---------------------------

def D3 = openingRangelow - range - halfrange;
plot D3Plot = if bearishORB and tradeEntryRange then D3 else double.nan;
D3Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D3Plot.setDefaultColor(Color.Red);


#-----------------------------

def D4 = openingRangelow - range - range;
plot D4Plot = if bearishORB and tradeEntryRange then D4 else double.nan;
D4Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D4Plot.setDefaultColor(Color.Red);


#-----------------------------

def D5 = openingRangelow - range - range - halfRange;
plot D5Plot = if bearishORB and tradeEntryRange then D5 else double.nan;
D5Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D5Plot.setDefaultColor(Color.Red);

#------------------------------

def D6 = openingRangelow - range - range - range;
plot D6Plot = if bearishORB and tradeEntryRange then D6 else double.nan;
D6Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D6Plot.setDefaultColor(Color.Red);

#-------------------------------

def D7 = openingRangelow - range - range - range - halfRange;
plot D7Plot = if bearishORB and tradeEntryRange then D7 else double.nan;
D7Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D7Plot.setDefaultColor(Color.DARK_Red);

#------------------------------------

def D8 = openingRangelow - range - range - range - range;
plot D8Plot = if bearishORB and tradeEntryRange then D8 else double.nan;
D8Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D8Plot.setDefaultColor(Color.DARK_Red);
 
i have this indicator for the ORB and i was wondering why this does not work on mobile, anway someone can tell me why? and possibly help me to convert it to be mobile friendly?


input openingRangeStartTimeEST = 930;
input openingRangeEndTimeEST = 1000;
def openingRange = if SecondsTillTime(openingRangeStartTimeEST) <= 0 and SecondsTillTime(openingRangeEndTimeEST) >= 0 then 1 else 0;

input entryType = {default wickTouch, closeAbove};

input tradeEntryStartTimeEST = 930;
input tradeEntryEndTimeEST = 1600;
def tradeEntryRange = if SecondsTillTime(tradeEntryStartTimeEST) <= 0 and SecondsTillTime(tradeEntryEndTimeEST) >= 0 then 1 else 0;

def openingRangeHigh = if SecondsTillTime(openingRangeStartTimeEST) == 0 then high else if openingRange and high > openingRangeHigh[1] then high else openingRangeHigh[1];
def openingRangeLow = if SecondsTillTime(openingRangeStartTimeEST) == 0 then low else if openingRange and low < openingRangeLow[1] then low else openingRangeLow[1];

plot tradeEntryHighExtension = if tradeEntryRange then openingRangeHigh else double.nan;
plot tradeEntryLowExtension = if tradeEntryRange then openingRangeLow else double.nan;

tradeEntryHighExtension.setPaintingStrategy(PaintingStrategy.Horizontal);
tradeEntryLowExtension.setPaintingStrategy(PaintingStrategy.Horizontal);

tradeEntryHighExtension.setStyle(Curve.FIRM);
tradeEntryLowExtension.setStyle(Curve.FIRM);

tradeEntryHighExtension.setDefaultColor(Color.CYAN);
tradeEntryLowExtension.setDefaultColor(Color.CYAN);

def bullEntryCondition;
def bearEntryCondition;

switch(entryType){
case wickTouch:
bullEntryCondition = tradeEntryRange and high > openingRangeHigh and high[1] <= openingRangeHigh;
bearEntryCondition = tradeEntryRange and low < openingRangeLow and low[1] >= openingRangeLow;
case closeAbove:
bullEntryCondition = tradeEntryRange and close > openingRangeHigh and close[1] <= openingRangeHigh;
bearEntryCondition = tradeEntryRange and close < openingRangeLow and close[1] >= openingRangeLow;
}

def bullishORB = if bullEntryCondition then 1 else if !tradeEntryRange then 0 else bullishORB[1];
def bearishORB = if bearEntryCondition then 1 else if !tradeEntryRange then 0 else bearishORB[1];

def range = openingRangeHigh - OpeningRangeLow;
def halfRange = range / 2;
def midRange = openingRangeLow + halfRange;

plot midRangePlot = if tradeEntryRange then midRange else double.nan;
midRangePlot.setPaintingStrategy(PaintingStrategy.Horizontal);
midRangePlot.setStyle(Curve.Short_Dash);
midRangePlot.setDefaultColor(Color.VIOLET);

#-------------------------

def P1 = openingRangehigh + halfRange;
plot P1Plot = if bullishORB and tradeEntryRange then P1 else double.nan;
P1Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P1Plot.setDefaultColor(Color.Light_Green);

#-------------------------

def P2 = openingRangehigh + range;
plot P2Plot = if bullishORB and tradeEntryRange then P2 else double.nan;
P2Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P2Plot.setDefaultColor(Color.Light_Green);

#-----------------------------------
def P3 = openingRangehigh + range + halfrange;
plot P3Plot = if bullishORB and tradeEntryRange then P3 else double.nan;
P3Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P3Plot.setDefaultColor(Color.Green);

#-----------------------------------


def P4 = openingRangehigh + range + range;
plot P4Plot = if bullishORB and tradeEntryRange then P4 else double.nan;
P4Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P4Plot.setDefaultColor(Color.Green);


#-----------------------------------

def P5 = openingRangehigh + range + range + halfrange;
plot P5Plot = if bullishORB and tradeEntryRange then P5 else double.nan;
P5Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P5Plot.setDefaultColor(Color.Green);



#------------------------------------

def P6 = openingRangehigh + range + range + range;
plot P6Plot = if bullishORB and tradeEntryRange then P6 else double.nan;
P6Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P6Plot.setDefaultColor(Color.DARK_Green);



#------------------------------------

def P7 = openingRangehigh + range + range + range + halfRange;
plot P7Plot = if bullishORB and tradeEntryRange then P7 else double.nan;
P7Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P7Plot.setDefaultColor(Color.DARK_Green);



#-----------------------------------

def P8 = openingRangehigh + range + range + range + range;
plot P8Plot = if bullishORB and tradeEntryRange then P8 else double.nan;
P8Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P8Plot.setDefaultColor(Color.DARK_Green);


#-----------------------------------


def D1 = openingRangelow - halfRange;
plot D1Plot = if bearishORB and tradeEntryRange then D1 else double.nan;
D1Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D1Plot.setDefaultColor(Color.ORANGE);

#---------------------------------
def D2 = openingRangelow - range;
plot D2Plot = if bearishORB and tradeEntryRange then D2 else double.nan;
D2Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D2Plot.setDefaultColor(Color.ORANGE);
#---------------------------

def D3 = openingRangelow - range - halfrange;
plot D3Plot = if bearishORB and tradeEntryRange then D3 else double.nan;
D3Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D3Plot.setDefaultColor(Color.Red);


#-----------------------------

def D4 = openingRangelow - range - range;
plot D4Plot = if bearishORB and tradeEntryRange then D4 else double.nan;
D4Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D4Plot.setDefaultColor(Color.Red);


#-----------------------------

def D5 = openingRangelow - range - range - halfRange;
plot D5Plot = if bearishORB and tradeEntryRange then D5 else double.nan;
D5Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D5Plot.setDefaultColor(Color.Red);

#------------------------------

def D6 = openingRangelow - range - range - range;
plot D6Plot = if bearishORB and tradeEntryRange then D6 else double.nan;
D6Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D6Plot.setDefaultColor(Color.Red);

#-------------------------------

def D7 = openingRangelow - range - range - range - halfRange;
plot D7Plot = if bearishORB and tradeEntryRange then D7 else double.nan;
D7Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D7Plot.setDefaultColor(Color.DARK_Red);

#------------------------------------

def D8 = openingRangelow - range - range - range - range;
plot D8Plot = if bearishORB and tradeEntryRange then D8 else double.nan;
D8Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D8Plot.setDefaultColor(Color.DARK_Red);

not sure, but maybe these links will help.
https://usethinkscript.com/threads/answers-to-commonly-asked-questions.6006/#post-58079

if something doesn't work, simplify it.
this has a lot of plots. make a copy and remove all but 1 plot.
then disable the painting strategies,
strategy(horizontal) line.
setStyle(Curve.FIRM)

disable labels and bubbles.
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Solution
@halcyonguy is correct.
Very few formatting statements work on mobile.

A forum search found a post that might have an alternate solution for you:
https://usethinkscript.com/threads/...latility-for-thinkorswim.164/page-3#post-3515

Here is how to search the forum for future questions:
https://usethinkscript.com/threads/search-the-forum.12626/


Refer to the link provided by @halcyonguy for more information about using custom studies on the mobile app
I tried but it’s still doing the same problem I wish I knew how to post pictures, so I can show you what my issue is specifically
 
I tried but it’s still doing the same problem I wish I knew how to post pictures, so I can show you what my issue is specifically
We can't help you if you don't post your current script.
It sounds like:
1. you are not using the orb mobile provided in the above link.
2. you have not removed all the formatting statements
(they usually have the words SET or ASSiGN or ADD)
They don't work on the mobile app


If you're unsure of how to share chart links or upload screenshots to the forum, don't worry, we've included some easy-to-follow directions for you.
How to create a shared chart link:
https://usethinkscript.com/threads/how-to-share-a-chart-in-thinkorswim.14221/
How to upload screenshots to the forum:
https://usethinkscript.com/threads/answers-to-commonly-asked-questions.6006/#post-58714
 
We can't help you if you don't post your current script.
It sounds like:
1. you are not using the orb mobile provided in the above link.
2. you have not removed all the formatting statements
(they usually have the words SET or ASSiGN or ADD)
They don't work on the mobile app


If you're unsure of how to share chart links or upload screenshots to the forum, don't worry, we've included some easy-to-follow directions for you.
How to create a shared chart link:
https://usethinkscript.com/threads/how-to-share-a-chart-in-thinkorswim.14221/
How to upload screenshots to the forum:
https://usethinkscript.com/threads/answers-to-commonly-asked-questions.6006/#post-58714
I do not have assign or add, I removed all but the first 2 profit targets upper and lower. Also I removed the painting strategy. Haven’t removed SET though

But and it works on the computer, but when I load it on mobile the line for high orb entry and low orb entry just trace the high and low of every candle. Instead of being a straight line starting at the designated orb range. I need a simple orb plotted with 2 volatility bands above and below. Using the range as the rule of measurement, first profit target is = to half orb range and the second is full range.
 
Code:
declare lower;

input len = 50;
input upLevel = 50;
input downLevel = 50;

def src = close;
def up = ExpAverage(Max(src - src[1], 0), len);
def down = ExpAverage(-Min(src - src[1], 0), len);
def rsi = if down == 0 then 100 else if up == 0 then 0 else 100 - (100 / (1 + up / down));

def isUp = rsi > upLevel;
def isDown = rsi < downLevel;
def barcolor_ = if isUp then 1 else if isDown then -1 else 0;

AssignPriceColor(if barcolor_ > 0 then Color.GREEN else if barcolor_ < 0 then Color.RED else Color.GRAY);

#--End Code---


the color doesn't work on mobile, what other way can I get the color to work?
 
Code:
AssignPriceColor(if barcolor_ > 0 then Color.GREEN else if barcolor_ < 0 then Color.RED else Color.GRAY);

This will not work on mobile.

Replace it with the following:

Code:
plot color_trend = if barcolor_ > 0 then 1 else 0;

If the candles are green, then it will display a value of 1; else, 0.
 
Code:
AssignPriceColor(if barcolor_ > 0 then Color.GREEN else if barcolor_ < 0 then Color.RED else Color.GRAY);

This will not work on mobile.

Replace it with the following:

Code:
plot color_trend = if barcolor_ > 0 then 1 else 0;

If the candles are green, then it will display a value of 1; else, 0.
is there any way to color the candles though?

I don't know why I had the declare lower line there, so I removed it.

input LENGTH = 50;
input BULLISH = 52;
input BEARISH = 48;

def src = close;
def up = ExpAverage(Max(src - src[1], 0), lenGTH);
def down = ExpAverage(-Min(src - src[1], 0), lenGTH);
def rsi = if down == 0 then 100 else if up == 0 then 0 else 100 - (100 / (1 + up / down));

def isUp = rsi > BULLISH;
def isDown = rsi < BEARISH;
def barcolor_ = if isUp then 1 else if isDown then -1 else 0;

AssignPriceColor(if barcolor_ > 0 then Color.GREEN else if barcolor_ < 0 then Color.RED else Color.GRAY);
 
@hazmat8039 As mentioned in my previous message, "AssignPriceColor" will not work on the mobile app. That's why we have to transform the study into a lower study so that it can give you the same information in a different style.
 
FYI to all mobile app users:
ThinkScript statements that contain ASSiGN or ADD or any SET statements with exception of:
SetDefault Color and SetPaintingStrategy(PaintingStrategy Arrow statements
Do Not work on the mobile app

@hazmat8039 :
https://usethinkscript.com/threads/orb-for-mobile.14597/#post-120834
ok now that's been clarified, why doesn't this do what its supposed to do for mobile?
example on PC it plots all lines horizontally and perfectly. but on mobile the high low and half range are changing constantly to the high low and mid of each candle. and the profit targets are not being triggered.
I don't see any assign set or ADD. unless I'm misunderstanding. I am using the orb for mobile you all have but its not great, and I can't easily switch between range times like, if I wanted to do a 15min orb vs a 30min orb, etc.

Code:
input openingRangeStartTimeEST = 930;
input openingRangeEndTimeEST = 1000;
def openingRange = if SecondsTillTime(openingRangeStartTimeEST) <= 0 and SecondsTillTime(openingRangeEndTimeEST) >= 0 then 1 else 0;

input entryType = {default wickTouch, closeAbove};

input tradeEntryStartTimeEST = 930;
input tradeEntryEndTimeEST = 1600;
def tradeEntryRange = if SecondsTillTime(tradeEntryStartTimeEST) <= 0 and SecondsTillTime(tradeEntryEndTimeEST) >= 0 then 1 else 0;

def openingRangeHigh = if SecondsTillTime(openingRangeStartTimeEST) == 0 then high else if openingRange and high > openingRangeHigh[1] then high else openingRangeHigh[1];
def openingRangeLow = if SecondsTillTime(openingRangeStartTimeEST) == 0 then low else if openingRange and low < openingRangeLow[1] then low else openingRangeLow[1];

plot tradeEntryHighExtension = if tradeEntryRange then openingRangeHigh else double.nan;
plot tradeEntryLowExtension = if tradeEntryRange then openingRangeLow else double.nan;

tradeEntryHighExtension.setPaintingStrategy(PaintingStrategy.Horizontal);
tradeEntryLowExtension.setPaintingStrategy(PaintingStrategy.Horizontal);

tradeEntryHighExtension.setStyle(Curve.FIRM);
tradeEntryLowExtension.setStyle(Curve.FIRM);

tradeEntryHighExtension.setDefaultColor(Color.CYAN);
tradeEntryLowExtension.setDefaultColor(Color.CYAN);

def bullEntryCondition;
def bearEntryCondition;

switch(entryType){
case wickTouch:
    bullEntryCondition = tradeEntryRange and high > openingRangeHigh and high[1] <= openingRangeHigh;
    bearEntryCondition = tradeEntryRange and low < openingRangeLow and low[1] >= openingRangeLow;
case closeAbove:
    bullEntryCondition = tradeEntryRange and close > openingRangeHigh and close[1] <= openingRangeHigh;
    bearEntryCondition = tradeEntryRange and close < openingRangeLow and close[1] >= openingRangeLow;
}

def bullishORB = if bullEntryCondition then 1 else if !tradeEntryRange then 0 else bullishORB[1];
def bearishORB = if bearEntryCondition then 1 else if !tradeEntryRange then 0 else bearishORB[1];

def range = openingRangeHigh - OpeningRangeLow;
def halfRange = range / 2;
def midRange = openingRangeLow + halfRange;

plot midRangePlot = if tradeEntryRange then midRange else double.nan;
midRangePlot.setPaintingStrategy(PaintingStrategy.Horizontal);
midRangePlot.setStyle(Curve.Short_Dash);
midRangePlot.setDefaultColor(Color.VIOLET);

#-------------------------

def P1 = openingRangehigh + halfRange;
plot P1Plot = if bullishORB and tradeEntryRange then P1 else double.nan;
P1Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P1Plot.setDefaultColor(Color.Light_Green);

#-------------------------

def P2 = openingRangehigh + range;
plot P2Plot = if bullishORB and tradeEntryRange then P2 else double.nan;
P2Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P2Plot.setDefaultColor(Color.Light_Green);

#-----------------------------------
def P3 = openingRangehigh + range + halfrange;
plot P3Plot = if bullishORB and tradeEntryRange then P3 else double.nan;
P3Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P3Plot.setDefaultColor(Color.Green);

#-----------------------------------


def P4 = openingRangehigh + range + range;
plot P4Plot = if bullishORB and tradeEntryRange then P4 else double.nan;
P4Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P4Plot.setDefaultColor(Color.Green);


#-----------------------------------

def P5 = openingRangehigh + range + range + halfrange;
plot P5Plot = if bullishORB and tradeEntryRange then P5 else double.nan;
P5Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P5Plot.setDefaultColor(Color.Green);



#------------------------------------

def P6 = openingRangehigh + range + range + range;
plot P6Plot = if bullishORB and tradeEntryRange then P6 else double.nan;
P6Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P6Plot.setDefaultColor(Color.DARK_Green);



#------------------------------------

def P7 = openingRangehigh + range + range + range + halfRange;
plot P7Plot = if bullishORB and tradeEntryRange then P7 else double.nan;
P7Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P7Plot.setDefaultColor(Color.DARK_Green);



#-----------------------------------

def P8 = openingRangehigh + range + range + range + range;
plot P8Plot = if bullishORB and tradeEntryRange then P8 else double.nan;
P8Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P8Plot.setDefaultColor(Color.DARK_Green);


#-----------------------------------


def D1 = openingRangelow - halfRange;
plot D1Plot = if bearishORB and tradeEntryRange then D1 else double.nan;
D1Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D1Plot.setDefaultColor(Color.ORANGE);

#---------------------------------
def D2 = openingRangelow - range;
plot D2Plot = if bearishORB and tradeEntryRange then D2 else double.nan;
D2Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D2Plot.setDefaultColor(Color.ORANGE);
#---------------------------

def D3 = openingRangelow - range - halfrange;
plot D3Plot = if bearishORB and tradeEntryRange then D3 else double.nan;
D3Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D3Plot.setDefaultColor(Color.Red);


#-----------------------------

def D4 = openingRangelow - range - range;
plot D4Plot = if bearishORB and tradeEntryRange then D4 else double.nan;
D4Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D4Plot.setDefaultColor(Color.Red);


#-----------------------------

def D5 = openingRangelow - range - range - halfRange;
plot D5Plot = if bearishORB and tradeEntryRange then D5 else double.nan;
D5Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D5Plot.setDefaultColor(Color.Red);

#------------------------------

def D6 = openingRangelow - range - range - range;
plot D6Plot = if bearishORB and tradeEntryRange then D6 else double.nan;
D6Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D6Plot.setDefaultColor(Color.Red);

#-------------------------------

def D7 = openingRangelow - range - range - range - halfRange;
plot D7Plot = if bearishORB and tradeEntryRange then D7 else double.nan;
D7Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D7Plot.setDefaultColor(Color.DARK_Red);

#------------------------------------

def D8 = openingRangelow - range - range - range - range;
plot D8Plot = if bearishORB and tradeEntryRange then D8 else double.nan;
D8Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D8Plot.setDefaultColor(Color.DARK_Red);
 
ok now that's been clarified, why doesn't this do what its supposed to do for mobile?
example on PC it plots all lines horizontally and perfectly. but on mobile the high low and half range are changing constantly to the high low and mid of each candle. and the profit targets are not being triggered.
I don't see any assign set or ADD. unless I'm misunderstanding. I am using the orb for mobile you all have but its not great, and I can't easily switch between range times like, if I wanted to do a 15min orb vs a 30min orb, etc.


input openingRangeStartTimeEST = 930;
input openingRangeEndTimeEST = 1000;
def openingRange = if SecondsTillTime(openingRangeStartTimeEST) <= 0 and SecondsTillTime(openingRangeEndTimeEST) >= 0 then 1 else 0;

input entryType = {default wickTouch, closeAbove};

input tradeEntryStartTimeEST = 930;
input tradeEntryEndTimeEST = 1600;
def tradeEntryRange = if SecondsTillTime(tradeEntryStartTimeEST) <= 0 and SecondsTillTime(tradeEntryEndTimeEST) >= 0 then 1 else 0;

def openingRangeHigh = if SecondsTillTime(openingRangeStartTimeEST) == 0 then high else if openingRange and high > openingRangeHigh[1] then high else openingRangeHigh[1];
def openingRangeLow = if SecondsTillTime(openingRangeStartTimeEST) == 0 then low else if openingRange and low < openingRangeLow[1] then low else openingRangeLow[1];

plot tradeEntryHighExtension = if tradeEntryRange then openingRangeHigh else double.nan;
plot tradeEntryLowExtension = if tradeEntryRange then openingRangeLow else double.nan;

tradeEntryHighExtension.setPaintingStrategy(PaintingStrategy.Horizontal);
tradeEntryLowExtension.setPaintingStrategy(PaintingStrategy.Horizontal);

tradeEntryHighExtension.setStyle(Curve.FIRM);
tradeEntryLowExtension.setStyle(Curve.FIRM);

tradeEntryHighExtension.setDefaultColor(Color.CYAN);
tradeEntryLowExtension.setDefaultColor(Color.CYAN);

def bullEntryCondition;
def bearEntryCondition;

switch(entryType){
case wickTouch:
bullEntryCondition = tradeEntryRange and high > openingRangeHigh and high[1] <= openingRangeHigh;
bearEntryCondition = tradeEntryRange and low < openingRangeLow and low[1] >= openingRangeLow;
case closeAbove:
bullEntryCondition = tradeEntryRange and close > openingRangeHigh and close[1] <= openingRangeHigh;
bearEntryCondition = tradeEntryRange and close < openingRangeLow and close[1] >= openingRangeLow;
}

def bullishORB = if bullEntryCondition then 1 else if !tradeEntryRange then 0 else bullishORB[1];
def bearishORB = if bearEntryCondition then 1 else if !tradeEntryRange then 0 else bearishORB[1];

def range = openingRangeHigh - OpeningRangeLow;
def halfRange = range / 2;
def midRange = openingRangeLow + halfRange;

plot midRangePlot = if tradeEntryRange then midRange else double.nan;
midRangePlot.setPaintingStrategy(PaintingStrategy.Horizontal);
midRangePlot.setStyle(Curve.Short_Dash);
midRangePlot.setDefaultColor(Color.VIOLET);

#-------------------------

def P1 = openingRangehigh + halfRange;
plot P1Plot = if bullishORB and tradeEntryRange then P1 else double.nan;
P1Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P1Plot.setDefaultColor(Color.Light_Green);

#-------------------------

def P2 = openingRangehigh + range;
plot P2Plot = if bullishORB and tradeEntryRange then P2 else double.nan;
P2Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P2Plot.setDefaultColor(Color.Light_Green);

#-----------------------------------
def P3 = openingRangehigh + range + halfrange;
plot P3Plot = if bullishORB and tradeEntryRange then P3 else double.nan;
P3Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P3Plot.setDefaultColor(Color.Green);

#-----------------------------------


def P4 = openingRangehigh + range + range;
plot P4Plot = if bullishORB and tradeEntryRange then P4 else double.nan;
P4Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P4Plot.setDefaultColor(Color.Green);


#-----------------------------------

def P5 = openingRangehigh + range + range + halfrange;
plot P5Plot = if bullishORB and tradeEntryRange then P5 else double.nan;
P5Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P5Plot.setDefaultColor(Color.Green);



#------------------------------------

def P6 = openingRangehigh + range + range + range;
plot P6Plot = if bullishORB and tradeEntryRange then P6 else double.nan;
P6Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P6Plot.setDefaultColor(Color.DARK_Green);



#------------------------------------

def P7 = openingRangehigh + range + range + range + halfRange;
plot P7Plot = if bullishORB and tradeEntryRange then P7 else double.nan;
P7Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P7Plot.setDefaultColor(Color.DARK_Green);



#-----------------------------------

def P8 = openingRangehigh + range + range + range + range;
plot P8Plot = if bullishORB and tradeEntryRange then P8 else double.nan;
P8Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
P8Plot.setDefaultColor(Color.DARK_Green);


#-----------------------------------


def D1 = openingRangelow - halfRange;
plot D1Plot = if bearishORB and tradeEntryRange then D1 else double.nan;
D1Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D1Plot.setDefaultColor(Color.ORANGE);

#---------------------------------
def D2 = openingRangelow - range;
plot D2Plot = if bearishORB and tradeEntryRange then D2 else double.nan;
D2Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D2Plot.setDefaultColor(Color.ORANGE);
#---------------------------

def D3 = openingRangelow - range - halfrange;
plot D3Plot = if bearishORB and tradeEntryRange then D3 else double.nan;
D3Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D3Plot.setDefaultColor(Color.Red);


#-----------------------------

def D4 = openingRangelow - range - range;
plot D4Plot = if bearishORB and tradeEntryRange then D4 else double.nan;
D4Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D4Plot.setDefaultColor(Color.Red);


#-----------------------------

def D5 = openingRangelow - range - range - halfRange;
plot D5Plot = if bearishORB and tradeEntryRange then D5 else double.nan;
D5Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D5Plot.setDefaultColor(Color.Red);

#------------------------------

def D6 = openingRangelow - range - range - range;
plot D6Plot = if bearishORB and tradeEntryRange then D6 else double.nan;
D6Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D6Plot.setDefaultColor(Color.Red);

#-------------------------------

def D7 = openingRangelow - range - range - range - halfRange;
plot D7Plot = if bearishORB and tradeEntryRange then D7 else double.nan;
D7Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D7Plot.setDefaultColor(Color.DARK_Red);

#------------------------------------

def D8 = openingRangelow - range - range - range - range;
plot D8Plot = if bearishORB and tradeEntryRange then D8 else double.nan;
D8Plot.setPaintingStrategy(PaintingStrategy.Horizontal);
D8Plot.setDefaultColor(Color.DARK_Red);
The only SET statements that are supported on the mobile app are SetDefault and SetPainting Arrows.
The script that you are quoting is solely dependent on the lines being drawn WITH SET STATEMENTS NOT SUPPORTED ON THE MOBILE APP.

There is no workaround to get it to work. Which is why the ORB mobile is the only alternative.
 
Is there a way to make this orb for mobile script have inputs so I can switch orb time instead of having the get time preset into the script?
like incorporating the following:

Code:
"#-------Begin Example------

input openingRangeStartTimeEST = 930;
input openingRangeEndTimeEST = 1000;
def openingRange = if SecondsTillTime(openingRangeStartTimeEST) <= 0 and SecondsTillTime(openingRangeEndTimeEST) >= 0 then 1 else 0;

input entryType = {default wickTouch, closeAbove};

input tradeEntryStartTimeEST = 930;
input tradeEntryEndTimeEST = 1600;
def tradeEntryRange = if SecondsTillTime(tradeEntryStartTimeEST) <= 0 and SecondsTillTime(tradeEntryEndTimeEST) >= 0 then 1 else 0;

#-------end example-----"

to this?

# ORB for TOS Mobile App
# Mobius
# V01.08.2018

def o = open;
def h = high;
def l = low;
def c = close;
def OpeningBell = getTime()[1] < RegularTradingStart(getYYYYMMDD()) and
                  getTime() > RegularTradingStart(getYYYYMMDD());
def RTH = getTime() >= RegularTradingStart(getYYYYMMDD()) and
          getTime() <= RegularTradingEnd(getYYYYMMDD());
def ORActive = getTime() >= RegularTradingStart(getYYYYMMDD()) and
               getTime() <= RegularTradingStart(getYYYYMMDD()) + 1850000;

def ORH = if OpeningBell
          then h
          else if ORActive and
                  h > ORH[1]
               then h
               else ORH[1];
def ORL = if OpeningBell
          then l
          else if ORActive and
                  l < ORL[1]
               then l
               else ORL[1];
plot ORhigh = if !ORActive and RTH
              then ORH
              else Double.NaN;
ORhigh.SetStyle(Curve.LONG_DASH);
ORhigh.SetLineWeight(1);
ORhigh.SetDefaultColor(Color.GREEN);
plot ORlow = if !ORActive and RTH
             then ORL
             else Double.NaN;
ORlow.SetStyle(Curve.LONG_DASH);
ORlow.SetLineWeight(1);
ORlow.SetDefaultColor(Color.RED);
def ORmeanActive = getTime() >= OpeningBell and
                   getTime() <= RegularTradingStart(getYYYYMMDD()) + 1850000;
def ORmeanH = if OpeningBell
              then h
              else if ORmeanActive and h > ORmeanH[1]
                   then h
                   else ORmeanH[1];
def ORmeanL = if OpeningBell
              then l
              else if ORmeanActive and l < ORmeanL[1]
                   then l
                   else ORmeanL[1];
plot ORmean = if !ORmeanActive and RTH
              then Round(((ORmeanH + ORmeanL) / 2) / TickSize(), 0) * TickSize()
              else Double.NaN;
ORmean.SetStyle(Curve.LONG_DASH);
ORmean.SetLineWeight(3);
ORmean.SetDefaultColor(Color.YELLOW);
#-----------------

def range = ORH - ORL;
def halfRange = range / 2;
def midRange = ORL + halfRange;


#---------------------------------------

def P1 = ORhigh + (halfRange * 1.25);
plot P1Plot = if ORhigh and ORhigh then P1 else double.nan;
p1Plot.SetStyle(Curve.LONG_DASH);
p1plot.SetLineWeight(3);
p1plot.SetDefaultColor(Color.GREEN);

#---------------------------------------

def P2 = ORhigh + (halfRange * 1.25)*2;
plot P2Plot = if ORhigh and ORhigh then P2 else double.nan;
p2Plot.SetStyle(Curve.LONG_DASH);
p2plot.SetLineWeight(3);
p2plot.SetDefaultColor(Color.dark_GREEN);


#---------------------------------------

def P3 = ORhigh +(halfRange * 1.25)*3;
plot P3Plot = if ORhigh and ORhigh then P3 else double.nan;
p3Plot.SetStyle(Curve.LONG_DASH);
p3plot.SetLineWeight(3);
p3plot.SetDefaultColor(Color.dark_GREEN);

#---------------------------------------

def P4 = ORhigh + (halfRange * 1.25)*4;
plot P4Plot = if ORhigh and ORhigh then P4 else double.nan;
p4Plot.SetStyle(Curve.LONG_DASH);
p4plot.SetLineWeight(3);
p4plot.SetDefaultColor(Color.dark_GREEN);
#------------------------------------

def D1 = orlow - (halfrange * 1.25);
plot D1Plot = if orlow and orlow then D1 else double.nan;
d1Plot.SetStyle(Curve.LONG_DASH);
d1plot.SetLineWeight(3);
d1plot.SetDefaultColor(Color.orANGE);

#---------------------------------------

def D2 = orlow - (halfRange * 1.25)*2;
plot D2Plot = if orlow and ORlow then D2 else double.nan;
d2Plot.SetStyle(Curve.LONG_DASH);
d2plot.SetLineWeight(3);
d2plot.SetDefaultColor(Color.dark_rED);

#---------------------------------------

def D3 = ORLOW - (halfRange * 1.25)*3;
plot D3Plot = if ORLOW and ORLOW then D3 else double.nan;
D3Plot.SetStyle(Curve.LONG_DASH);
D3plot.SetLineWeight(3);
D3plot.SetDefaultColor(Color.dark_RED);

#---------------------------------------

def D4 = ORLOW - (halfRange * 1.25)*4;
plot D4Plot = if ORLOW and ORLOW then D4 else double.nan;
D4Plot.SetStyle(Curve.LONG_DASH);
D4plot.SetLineWeight(3);
D4plot.SetDefaultColor(Color.dark_RED);
#----------------------------------

def bullish_cross = close crosses above orhigh;
def bearish_cross = close crosses below orlow;

# Alerts
Alert(bullish_cross, " ", Alert.Bar, Sound.Chimes);
Alert(bearish_cross, " ", Alert.Bar, Sound.Bell);
# End Code ORB for Mobile App
 
Last edited by a moderator:
Thread starter Similar threads Forum Replies Date
X Add High Lows to ORB Questions 0
S ORB Alert / Scan Questions 0
D Orb difference Questions 2
I ORB End Time Questions 2
S Help Creating An ORB Study Questions 3

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
312 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

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.

How do I get started?

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.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top