Market Profile (TPOProfile) for ThinkorSwim

markos

Well-known member
VIP
Here's a TPO Refined with Monkey Bars script for ThinkorSwim.

Code:
# TPO Refined with Monkey Bar Study
# Mobius
# V01.04.07.2018

input pricePerRowHeightMode = {AUTOMATIC, default TICKSIZE, CUSTOM};
input customRowHeight = 1.0;
input aggregationPeriod = {"1 min", "2 min", "3 min", "4 min", "5 min", "10 min", "15 min", "20 min", default "30 min", "1 hour", "2 hours", "4 hours", "Day", "2 Days", "3 Days", "4 Days", "Week", "Month"};
input timePerProfile = {CHART, MINUTE, HOUR, default DAY, WEEK, MONTH, "OPT EXP", BAR, YEAR};
input multiplier = 1;
input onExpansion = no;
input profiles = 5;
input showMonkeyBar = no;
input showThePlayground = no;
input thePlaygroundPercent = 70;
input opacity = 25;
input emphasizeFirstDigit = no;
input markOpenPrice = no;
input markClosePrice = no;
input volumeShowStyle = MonkeyVolumeShowStyle.NONE;
input showVolumeVA = yes;
input showVolumePoc = yes;
input theVolumePercent = 70;
input showInitialBalance = no;
input initialBalanceRange = 1;

def period;
def yyyymmdd = GetYYYYMMDD();
def seconds = SecondsFromTime(0);
def month = GetYear() * 12 + GetMonth();
def day_number = DaysFromDate(First(yyyymmdd)) + GetDayOfWeek(First(yyyymmdd));
def dom = GetDayOfMonth(yyyymmdd);
def dow = GetDayOfWeek(yyyymmdd - dom + 1);
def expthismonth = (if dow > 5 then 27 else 20) - dow;
def exp_opt = month + (dom > expthismonth);
def periodMin = Floor(seconds / 60 + day_number * 24 * 60);
def periodHour = Floor(seconds / 3600 + day_number * 24);
def periodDay = CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 1;
def periodWeek = Floor(day_number / 7);
def periodMonth = month - First(month);

switch (timePerProfile) {
case CHART:
    period = 0;
case MINUTE:
    period = periodMin;
case HOUR:
    period = periodHour;
case DAY:
    period = periodDay;
case WEEK:
    period = periodWeek;
case MONTH:
    period = periodMonth;
case "OPT EXP":
    period = exp_opt - First(exp_opt);
case BAR:
    period = BarNumber() - 1;
case YEAR:
    period = GetYear() - First(GetYear());
}

input RthBegin  = 0930;
input RthEnd    = 1600;
input Minutes = 60;
#input showBubbles = no;
def OpenRange = SecondsFromTime(0930) >= 0 and
                SecondsFromTime(1000) >= 0;
def bar = BarNumber();
def RTHBar1 = if SecondsFromTime(RthBegin) == 0 and
                 SecondsTillTime(RthBegin) == 0
              then bar
              else RTHBar1[1];
def RTHBarEnd = if SecondsFromTime(RthEnd) == 0 and
                   SecondsTillTime(RthEnd) == 0
                then 1
                else Double.NaN;
def RTH = SecondsFromTime(RthBegin) > 0 and
          SecondsTillTime(RthEnd) > 0;
def start_t = if RTH and !RTH[1]
              then GetTime()
              else start_t[1];
def t = if start_t == GetTime()
        then 1
        else GetTime() % (Minutes * 60 * 1000) == 0;
def cond = t;

def height;
switch (pricePerRowHeightMode) {
case AUTOMATIC:
    height = PricePerRow.AUTOMATIC;
case TICKSIZE:
    height = PricePerRow.TICKSIZE;
case CUSTOM:
    height = customRowHeight;
}

def timeInterval;
def aggMultiplier;
switch (aggregationPeriod) {
case "1 min":
    timeInterval = periodMin;
    aggMultiplier = 1;
case "2 min":
    timeInterval = periodMin;
    aggMultiplier = 2;
case "3 min":
    timeInterval = periodMin;
    aggMultiplier = 3;
case "4 min":
    timeInterval = periodMin;
    aggMultiplier = 4;
case "5 min":
    timeInterval = periodMin;
    aggMultiplier = 5;
case "10 min":
    timeInterval = periodMin;
    aggMultiplier = 10;
case "15 min":
    timeInterval = periodMin;
    aggMultiplier = 15;
case "20 min":
    timeInterval = periodMin;
    aggMultiplier = 20;
case "30 min":
    timeInterval = periodMin;
    aggMultiplier = 30;
case "1 hour":
    timeInterval = periodHour;
    aggMultiplier = 1;
case "2 hours":
    timeInterval = periodHour;
    aggMultiplier = 2;
case "4 hours":
    timeInterval = periodHour;
    aggMultiplier = 4;
case "Day":
    timeInterval = periodDay;
    aggMultiplier = 1;
case "2 Days":
    timeInterval = periodDay;
    aggMultiplier = 2;
case "3 Days":
    timeInterval = periodDay;
    aggMultiplier = 3;
case "4 Days":
    timeInterval = periodDay;
    aggMultiplier = 4;
case "Week":
    timeInterval = periodWeek;
    aggMultiplier = 1;
case "Month":
    timeInterval = periodMonth;
    aggMultiplier = 1;
}
def agg_count = CompoundValue(1, if timeInterval != timeInterval[1]
                                 then (GetValue(agg_count, 1) + timeInterval -
                                                  timeInterval[1]) % aggMultiplier
                                 else GetValue(agg_count, 1), 0);
def agg_cond = CompoundValue(1,  agg_count < agg_count[1] + timeInterval -
                                                            timeInterval[1], yes);
def digit = CompoundValue(1, if cond
                             then 1
                             else agg_cond + GetValue(digit, 1), 1);
profile monkey = MonkeyBars(digit,
                "startNewProfile" = cond,
                "onExpansion" = onExpansion,
                "numberOfProfiles" = profiles,
                "pricePerRow" = height,
                "the playground percent" = thePlaygroundPercent,
                "emphasize first digit" = emphasizeFirstDigit,
                "volumeProfileShowStyle" = volumeShowStyle,
                "volumePercentVA" = theVolumePercent,
                "show initial balance" = showInitialBalance,
                "initial balance range" = initialBalanceRange);
def con = CompoundValue(1, onExpansion, no);
def mbar = CompoundValue(1, if IsNaN(monkey.GetPointOfControl()) and con then GetValue(mbar, 1) else monkey.GetPointOfControl(), monkey.GetPointOfControl());
def hPG = CompoundValue(1, if IsNaN(monkey.GetHighestValueArea()) and con then GetValue(hPG, 1) else monkey.GetHighestValueArea(), monkey.GetHighestValueArea());
def lPG = CompoundValue(1, if IsNaN(monkey.GetLowestValueArea()) and con then GetValue(lPG, 1) else monkey.GetLowestValueArea(), monkey.GetLowestValueArea());
def hProfile = CompoundValue(1, if IsNaN(monkey.GetHighest()) and con then GetValue(hProfile, 1) else monkey.GetHighest(), monkey.GetHighest());
def lProfile = CompoundValue(1, if IsNaN(monkey.GetLowest()) and con then GetValue(lProfile, 1) else monkey.GetLowest(), monkey.GetLowest());
def plotsDomain = IsNaN(close) == onExpansion;
profile tpo = TimeProfile("startNewProfile" = t,
                          "onExpansion" = 0,
                          "numberOfProfiles" = profiles,
                          "pricePerRow" =  tickSize(),
                          "value area percent" = 70);
def showPointOfControl = yes;
def showValueArea = no;
plot MB = if plotsDomain then mbar else Double.NaN;
plot ProfileHigh = if plotsDomain then hProfile else Double.NaN;
plot ProfileLow = if plotsDomain then lProfile else Double.NaN;
plot PGHigh = if plotsDomain then hPG else Double.NaN;
plot PGLow = if plotsDomain then lPG else Double.NaN;

DefineGlobalColor("Monkey Bar", GetColor(4));
DefineGlobalColor("The Playground", GetColor(3));
DefineGlobalColor("Open Price", GetColor(1));
DefineGlobalColor("Close Price", GetColor(1));
DefineGlobalColor("Volume", GetColor(8));
DefineGlobalColor("Volume Value Area", GetColor(2));
DefineGlobalColor("Volume Point of Control", GetColor(3));
DefineGlobalColor("Initial Balance", GetColor(7));
DefineGlobalColor("Profiles", GetColor(1));
tpo.Show(GlobalColor("Profiles"), if showPointOfControl
                                 then GlobalColor("Volume Point Of Control")
                                 else Color.CURRENT,
                                 if showValueArea
                                 then GlobalColor("Volume Value Area")
                                 else Color.CURRENT, opacity);
MB.SetDefaultColor(GlobalColor("Monkey Bar"));
MB.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PGHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PGLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PGHigh.SetDefaultColor(GlobalColor("The Playground"));
PGLow.SetDefaultColor(GlobalColor("The Playground"));
ProfileHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ProfileLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ProfileHigh.SetDefaultColor(GetColor(3));
ProfileLow.SetDefaultColor(GetColor(3));
ProfileHigh.Hide();
ProfileLow.Hide();
# End Code TPO Refined

TPO (Time Price Opportunity) - User can choose time segments beginning at RTH Open

RxAEF5w.png


Code:
# TPO Per User Time Segment Starting at RTH
# Mobius
# Chat Room Request 03.29.2018

input pricePerRowHeightMode = {AUTOMATIC, TICKSIZE, default CUSTOM};
input customRowHeight = 1.0;
input timePerProfile = {CHART, default MINUTE, HOUR, DAY, WEEK, MONTH, "OPT EXP", BAR};
input multiplier = 1;
input onExpansion = no;
input profiles = 10;
input showPointOfControl = yes;
input showValueArea = yes;
input valueAreaPercent = 70;
input opacity = 7;
input Minutes = 60;

def period;
def yyyymmdd = getYyyyMmDd();
def seconds = secondsFromTime(0);
def month = getYear() * 12 + getMonth();
def day_number = daysFromDate(first(yyyymmdd)) + getDayOfWeek(first(yyyymmdd));
def dom = getDayOfMonth(yyyymmdd);
def dow = getDayOfWeek(yyyymmdd - dom + 1);
def expthismonth = (if dow > 5 then 27 else 20) - dow;
def exp_opt = month + (dom > expthismonth);
switch (timePerProfile) {
case CHART:
    period = 0;
case MINUTE:
    period = floor(seconds / 60 + day_number * 24 * 60);
case HOUR:
    period = floor(seconds / 3600 + day_number * 24);
case DAY:
    period = countTradingDays(Min(first(yyyymmdd), yyyymmdd), yyyymmdd) - 1;
case WEEK:
    period = floor(day_number / 7);
case MONTH:
    period = floor(month - first(month));
case "OPT EXP":
    period = exp_opt - first(exp_opt);
case BAR:
    period = barNumber() - 1;
}

input RthBegin  = 0930;
input RthEnd    = 1600;
#input showBubbles = no;

def bar = BarNumber();
def RTHBar1 = if SecondsFromTime(RthBegin) == 0 and
                 SecondsTillTime(RthBegin) == 0
              then bar
              else RTHBar1[1];
def RTHBarEnd = if SecondsFromTime(RthEnd) == 0 and
                   SecondsTillTime(RthEnd) == 0
                then 1
                else Double.NaN;
def RTH = SecondsFromTime(RthBegin) > 0 and
          SecondsTillTime(RthEnd) > 0;
def start_t = if RTH and !RTH[1]
              then getTime()
              else Start_t[1];
def t = if start_t == getTime()
        then 1
        else getTime() % (Minutes * 60 * 1000) == 0;
def cond = t;
def height;
switch (pricePerRowHeightMode) {
case AUTOMATIC:
    height = PricePerRow.AUTOMATIC;
case TICKSIZE:
    height = PricePerRow.TICKSIZE;
case CUSTOM:
    height = customRowHeight;
}

profile tpo = timeProfile("startNewProfile" = cond, "onExpansion" = onExpansion, "numberOfProfiles" = profiles, "pricePerRow" = height, "value area percent" = valueAreaPercent);
def con = compoundValue(1, onExpansion, no);
def pc = if IsNaN(tpo.getPointOfControl()) and con then pc[1] else tpo.getPointOfControl();
def hVA = if IsNaN(tpo.getHighestValueArea()) and con then hVA[1] else tpo.getHighestValueArea();
def lVA = if IsNaN(tpo.getLowestValueArea()) and con then lVA[1] else tpo.getLowestValueArea();

def hProfile = if IsNaN(tpo.getHighest()) and con then hProfile[1] else tpo.getHighest();
def lProfile = if IsNaN(tpo.getLowest()) and con then lProfile[1] else tpo.getLowest();
def plotsDomain = IsNaN(close) == onExpansion;

plot POC = if plotsDomain then pc else Double.NaN;
plot ProfileHigh = if plotsDomain then hProfile else Double.NaN;
plot ProfileLow = if plotsDomain then lProfile else Double.NaN;
plot VAHigh = if plotsDomain then hVA else Double.NaN;
plot VALow = if plotsDomain then lVA else Double.NaN;

DefineGlobalColor("Profile", GetColor(1));
DefineGlobalColor("Point Of Control", GetColor(5));
DefineGlobalColor("Value Area", GetColor(8));

tpo.show(globalColor("Profile"), if showPointOfControl then globalColor("Point Of Control") else color.current, if showValueArea then globalColor("Value Area") else color.current, opacity);
POC.SetDefaultColor(globalColor("Point Of Control"));
POC.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VAHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VALow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VAHigh.SetDefaultColor(globalColor("Value Area"));
VALow.SetDefaultColor(globalColor("Value Area"));
ProfileHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ProfileLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ProfileHigh.SetDefaultColor(GetColor(3));
ProfileLow.SetDefaultColor(GetColor(3));
ProfileHigh.hide();
ProfileLow.hide();
# End Code TPO Per User Time Segment

TPO scanner by BLT: https://tos.mx/TwmYTE
 
Last edited by a moderator:

mc01439

Well-known member
2019 Donor
VIP
Took a look at the TPO you uploaded today. Will need to watch for a bit during open hours before I can comment. Have never traded this before but always willing to look at anything if it can help improve my edge. Thank you for sharing.
 

horserider

Well-known member
VIP
The fun thing about these is if price has 2 closes above or below a VAL there is a very good chance it will continue to the opposite VAL. Check the VAL difference to see how much profit might be available.

This one is a Time Profile Line and will be very near the POC which is price based. I think technically the POC is said to be more accurate. For our trading I doubt it makes any difference.
 

ironlion2012

New member
Hello, I am new to TOS and am in need of assistance converting code from pinescript in TradingView to thinkscript for TOS. Can anyone assist in converting this code for a developing market profile? Again the code below is in PineScript Version 4 from TradingView. Looking to convert to ThinkScript for TOS.

Code:
//@version=4
study(title='Dev Market Profile', shorttitle='MP', overlay=true)
//  ||--    Inputs:
session_timeframe = input('D')
percent_of_tpo = input(0.70)
tf_high = high
tf_low = low
tf_close = close
//  ||--    Bars since session started:
session_bar_counter = bar_index - valuewhen(change(time(session_timeframe)) != 0, bar_index, 0)
//plot(session_bar_counter)
//  ||--    session high, low, range:
session_high = tf_high
session_low = tf_low
session_range = tf_high - tf_low

session_high := nz(session_high[1], tf_high)
session_low := nz(session_low[1], tf_low)
session_range := nz(session_high - session_low, 0.0)

//      ||--    recalculate session high, low and range:
if session_bar_counter == 0
    session_high := tf_high
    session_low := tf_low
    session_range := tf_high - tf_low
    session_range
if tf_high > session_high[1]
    session_high := tf_high
    session_range := session_high - session_low
    session_range
if tf_low < session_low[1]
    session_low := tf_low
    session_range := session_high - session_low
    session_range
plot(series=session_high, title='Session High', color=color.blue)
plot(series=session_low, title='Session Low', color=color.blue)
//plot(series=session_range, title='Session Range', color=black)
//  ||--    define tpo section range:
tpo_section_range = session_range / 21
//  ||--    function to get the frequency a specified range is visited:
f_frequency_of_range(_src, _upper_range, _lower_range, _length) =>
    _adjusted_length = _length < 1 ? 1 : _length
    _frequency = 0
    for _i = 0 to _adjusted_length - 1 by 1
        if _src[_i] >= _lower_range and _src[_i] <= _upper_range
            _frequency := _frequency + 1
            _frequency
    _return = nz(_frequency, 0)  // _adjusted_length
    _return
//  ||--    frequency the tpo range is visited:
tpo_00 = f_frequency_of_range(tf_close, session_high, session_high - tpo_section_range * 1, session_bar_counter)
tpo_01 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 1, session_high - tpo_section_range * 2, session_bar_counter)
tpo_02 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 2, session_high - tpo_section_range * 3, session_bar_counter)
tpo_03 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 3, session_high - tpo_section_range * 4, session_bar_counter)
tpo_04 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 4, session_high - tpo_section_range * 5, session_bar_counter)
tpo_05 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 5, session_high - tpo_section_range * 6, session_bar_counter)
tpo_06 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 6, session_high - tpo_section_range * 7, session_bar_counter)
tpo_07 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 7, session_high - tpo_section_range * 8, session_bar_counter)
tpo_08 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 8, session_high - tpo_section_range * 9, session_bar_counter)
tpo_09 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 9, session_high - tpo_section_range * 10, session_bar_counter)
tpo_10 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 10, session_high - tpo_section_range * 11, session_bar_counter)
tpo_11 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 11, session_high - tpo_section_range * 12, session_bar_counter)
tpo_12 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 12, session_high - tpo_section_range * 13, session_bar_counter)
tpo_13 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 13, session_high - tpo_section_range * 14, session_bar_counter)
tpo_14 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 14, session_high - tpo_section_range * 15, session_bar_counter)
tpo_15 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 15, session_high - tpo_section_range * 16, session_bar_counter)
tpo_16 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 16, session_high - tpo_section_range * 17, session_bar_counter)
tpo_17 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 17, session_high - tpo_section_range * 18, session_bar_counter)
tpo_18 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 18, session_high - tpo_section_range * 19, session_bar_counter)
tpo_19 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 19, session_high - tpo_section_range * 20, session_bar_counter)
tpo_20 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 20, session_high - tpo_section_range * 21, session_bar_counter)
//  ||--    function to retrieve a specific tpo value
f_get_tpo_count_1(_value) =>
    _return = 0.0
    if _value == 0
        _return := tpo_00
        _return
    if _value == 1
        _return := tpo_01
        _return
    if _value == 2
        _return := tpo_02
        _return
    if _value == 3
        _return := tpo_03
        _return
    if _value == 4
        _return := tpo_04
        _return
    if _value == 5
        _return := tpo_05
        _return
    if _value == 6
        _return := tpo_06
        _return
    if _value == 7
        _return := tpo_07
        _return
    if _value == 8
        _return := tpo_08
        _return
    if _value == 9
        _return := tpo_09
        _return
    if _value == 10
        _return := tpo_10
        _return
    if _value == 11
        _return := tpo_11
        _return
    if _value == 12
        _return := tpo_12
        _return
    if _value == 13
        _return := tpo_13
        _return
    if _value == 14
        _return := tpo_14
        _return
    if _value == 15
        _return := tpo_15
        _return
    if _value == 16
        _return := tpo_16
        _return
    if _value == 17
        _return := tpo_17
        _return
    if _value == 18
        _return := tpo_18
        _return
    if _value == 19
        _return := tpo_19
        _return
    if _value == 20
        _return := tpo_20
        _return
    _return
f_get_tpo_count_2(_value) =>
    _return = 0.0
    if _value == 0
        _return := tpo_00
        _return
    if _value == 1
        _return := tpo_01
        _return
    if _value == 2
        _return := tpo_02
        _return
    if _value == 3
        _return := tpo_03
        _return
    if _value == 4
        _return := tpo_04
        _return
    if _value == 5
        _return := tpo_05
        _return
    if _value == 6
        _return := tpo_06
        _return
    if _value == 7
        _return := tpo_07
        _return
    if _value == 8
        _return := tpo_08
        _return
    if _value == 9
        _return := tpo_09
        _return
    if _value == 10
        _return := tpo_10
        _return
    if _value == 11
        _return := tpo_11
        _return
    if _value == 12
        _return := tpo_12
        _return
    if _value == 13
        _return := tpo_13
        _return
    if _value == 14
        _return := tpo_14
        _return
    if _value == 15
        _return := tpo_15
        _return
    if _value == 16
        _return := tpo_16
        _return
    if _value == 17
        _return := tpo_17
        _return
    if _value == 18
        _return := tpo_18
        _return
    if _value == 19
        _return := tpo_19
        _return
    if _value == 20
        _return := tpo_20
        _return
    _return

tpo_sum = 0.0
current_poc_position = 0.0
current_poc_value = 0.0
for _i = 0 to 20 by 1
    _get_tpo_value = f_get_tpo_count_1(_i)
    tpo_sum := tpo_sum + _get_tpo_value
    if _get_tpo_value > current_poc_value
        current_poc_position := _i
        current_poc_value := _get_tpo_value
        current_poc_value
//plot(series=tpo_sum, title='tpo_sum', color=red)
poc_upper = session_high - tpo_section_range * current_poc_position
poc_lower = session_high - tpo_section_range * (current_poc_position + 1)
plot(series=poc_upper, title='POC Upper', color=color.black)
plot(series=poc_lower, title='POC Lower', color=color.black)

//  ||--    get value area high/low
vah_position = current_poc_position
val_position = current_poc_position
current_sum = current_poc_value

for _i = 0 to 20 by 1
    if current_sum < tpo_sum * percent_of_tpo
        vah_position := max(0, vah_position - 1)
        current_sum := current_sum + f_get_tpo_count_2(round(vah_position))
        current_sum
    if current_sum < tpo_sum * percent_of_tpo
        val_position := min(20, val_position + 1)
        current_sum := current_sum + f_get_tpo_count_2(round(val_position))
        current_sum

vah_value = session_high - tpo_section_range * vah_position
val_value = session_high - tpo_section_range * (val_position + 1)
plot(series=vah_value, title='VAH', color=color.navy)
plot(series=val_value, title='VAL', color=color.navy)
//plot(series=current_sum, title='SUM', color=red)
 

adii800

Member
I felt that this question wasn't worth putting in the 'Strategies' section...Has anyone created a Strategy using the TPO Profile Indicator that's already in TOS?

I have a set of rules that make use of the TPO Profile by trading based on where the most volume was traded on a bar, however, when I go to make this a strategy it simply doesn't work...I know for sure that my conditions, addOrder() functions, etc. are correct and TOS isn't throwing any errors either. So my question is is it possible to use that indicator in TOS for strategies yet and/or has someone made a strategy based on this?

**PS: I'm not asking for anyone strategies or rules, just a yes or no in regards to was someone able to make their strategy work?

The rules of my strategy are immaterial(as suggested by the title) so let me rephrase my question:

Why do normal TPO Profile Indicator Plots (Specifically VAHigh and VALow) show up with a value of undefined, and is there a fix for this?
To be more specific, why will the following code not plot when inserted in the strategy section:

Code:
plot VAHigh = TPOProfile("price per row height mode" = "TICKSIZE", "time per profile" = "BAR", "on expansion" = No, "value area percent" = 1, "show point of control" = No, "show value area" = No).VAHigh;
plot VALow = TPOProfile("price per row height mode" = "TICKSIZE", "time per profile" = "BAR", "on expansion" = No, "value area percent" = 0).VALow;

Here is an image to show the desired result:

unknown.png


Here is what happens when I try and plot it using a strategy:

unknown.png


*Notice the values are Marked N/A :/

@rad14733 You can see how I referenced the VAHigh and VALow plots from the TPOProfile Indicator in my strategy In the above code. I think its correct, since I've been doing things that way for a while but do let me know :)

@MerryDay Again, this is not specific to making a strategy work, but rather making the Profiles calculate and plot properly :)

In case anyone is interested in an obscene amount of timePerProfile options or would like to pick and choose from this pool of them, follow the same instructions as above for the following piece of code:

Code:
input timePerProfile = {default M1, M2, M3, M4, M5, M10, M15, M20, M30, H1, H2, H4, D1, D2, D3, D4, Wk, Mo, Yr, OptX, Bar, Bar2, Bar3, Bar4, Bar5, Bar10, Bar15, Bar20, Bar30, Bar50, Bar100, Bar200, Bar250, Bar500, Bar1000, Chart};

Except for this one, replace the whole 'switch(timePerProfile){' function

Code:
switch (timePerProfile) {
case Chart:
    period = 0;
case M1:
    period = Floor(seconds / 60 + day_number * 24 * 60);
case M2:
    period = Floor(seconds / (60*2) + day_number * 24 * 60 / 2);
case M3:
    period = Floor(seconds / (60*3) + day_number * 24 * 60 / 3);
case M4:
    period = Floor(seconds / (60*4) + day_number * 24 * 60 / 4);
case M5:
    period = Floor(seconds / (60*5) + day_number * 24 * 60 / 5);
case M10:
    period = Floor(seconds / (60*10) + day_number * 24 * 60 / 10);
case M15:
    period = Floor(seconds / (60*15) + day_number * 24 * 60 / 15);
case M20:
    period = Floor(seconds / (60*20) + day_number * 24 * 60 / 20);
case M30:
    period = Floor(seconds / (60*30) + day_number * 24 * 60 / 30);
case H1:
    period = Floor(seconds / (60*60) + day_number * 24);
case H2:
    period = Floor(seconds / (60*60*2) + day_number * 24 / 2);
case H4:
    period = Floor(seconds / (60*60*4) + day_number * 24 / 4);
case D1:
    period = CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 1;
case D2:
    period = Floor((CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 1)/2);
case D3:
    period = Floor((CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 1)/3);
case D4:
    period = Floor((CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 1)/4);
#CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 2;
case Wk:
    period = Floor(day_number / 7);
case Mo:
    period = Floor(month - First(month));
case Yr:
    period = Floor(year - First(year));
case OptX:
    period = exp_opt - First(exp_opt);
case Bar:
    period = BarNumber() - 1;
case Bar2:
    period = Floor((BarNumber() - 1)/2);
case Bar3:
    period = Floor((BarNumber() - 1)/3);
case Bar4:
    period = Floor((BarNumber() - 1)/4);
case Bar5:
    period = Floor((BarNumber() - 1)/5);
case Bar10:
    period = Floor((BarNumber() - 1)/10);
case Bar15:
    period = Floor((BarNumber() - 1)/15);
case Bar20:
    period = Floor((BarNumber() - 1)/20);
case Bar30:
    period = Floor((BarNumber() - 1)/30);
case Bar50:
    period = Floor((BarNumber() - 1)/50);
case Bar100:
    period = Floor((BarNumber() - 1)/100);
case Bar200:
    period = Floor((BarNumber() - 1)/200);
case Bar250:
    period = Floor((BarNumber() - 1)/250);
case Bar500:
    period = Floor((BarNumber() - 1)/500);
case Bar1000:
    period = Floor((BarNumber() - 1)/1000);
}
 
Top