New version 18 available now


Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Profile: esc
About
User Name: esc
Groups: Gold User, Member, TeleChart
Rank: Registered User
Real Name:
Location
Occupation:
Interests:
Gender: Gender:
Statistics
Joined: Monday, March 11, 2013
Last Visit: Thursday, December 06, 2018 12:52:38 PM
Number of Posts: 22
[0.01% of all post / 0.01 posts per day]
Avatar
Last 10 Posts
Topic: Nested IIF and Greatest Functions
Posted: Thursday, December 06, 2018 8:18:58 AM

I have what I consider to be a complex PCF need.  I think it might be doable using nested IIF and Greatest functions but have not had luck so far.  Here is the logic:

Group A:
A1)  ABS(C2-L1)
A2)  ABS(C2-H1)
A3   H1-L1
 
Group B:
B1)  ABS(C1-L)
B2)  ABS(C1-H)
B3)  H-L
 
Scan1= Largest Group B value is 25% bigger than the largest Group A value 

Scan2= Largest Group B value is 25% smaller than the largest Group A value

 

Can anyone lend a hand?

Topic: Change Indicator Value Size (Font Size)
Posted: Thursday, January 25, 2018 10:13:07 AM

I know how to change Indicator scaling, date value size (to an extent) and price value size (to an extent).  However, I cannot find a way to increase the size of the values displayed for "On-chart" indicators (Such as Fib lines or horizontal lines.

How can the size of these fonts be increased?

Topic: horizontal line hotkey
Posted: Friday, September 29, 2017 3:28:25 PM

Is there a hotkey for drawing horizontal lines?

Topic: v12.6 Wilder RSI Cross in last 3 days
Posted: Wednesday, September 20, 2017 6:49:25 PM

Bruce (et al),

Is it possible to code a PCF (v12.6) to find WilderRSI (10day) crossing above 30 on any of the last 3 days?

I can do it for the current candle, but am not sure how to code offset days in a "from chart" scan.

Any help?

Thanks

Topic: Volatility Stop Flip Within X trading days
Posted: Friday, June 02, 2017 2:27:46 PM

Thanks

I've resisted moving from 12.6  I may be forced some day.  Until then I'll look for other options.

Topic: Volatility Stop Flip Within X trading days
Posted: Friday, June 02, 2017 2:11:50 PM

Is there a way to code (or create) a scan for the Volatility-Stop flipping (for example from Bearish trend to Bullish Trend) any of the last say 5 candles?

In other words, I'm looking for a Volatility Stop trend flip within the last week on daily charts.

Ideally, it would be PCF so I can modify the lookback period...but we'll work with what you can do.

Topic: Zig-zag pcf based off other platform logic
Posted: Saturday, March 11, 2017 6:44:38 AM

I was asked for help converting an indicator used in another platform into a scan pcf for TC2000.  This one is beyond me.  I realize that previous forum posts indicate 1) TC2000 does not currently have a zig-zag indicator and 2) a possibly related indicator from even a different platform was referred to development a few years back.

However, I did not know if anyone had tried to convert this particular 3rd-party code...and whether it might be more doable than the MT version referenced in 2015 and before.  At the very least, I figured it was worth a shot since another TC user had asked me.  So, below are the code for Zig-zag indicator and the function that it calls.

Any shot that it can be converted to pcf?

------------------------

Main script:

input priceH = high;
input priceL = low;
input percentageReversal = 5.0;
input absoluteReversal = 0.0;
input atrLength = 5;
input atrReversal = 1.5;
 
def zigZag = reference ZigZagHighLow(priceH, priceL, percentageReversal, absoluteReversal, atrLength, atrReversal).ZZ;
 
def step1 = open[1] >= open and open >= close[1] and open[1] > close[1];
def step2 = open[1] <= open and open <= close[1] and open[1] < close[1];
 
def upStep1 = step1 and close > open[1];
def upStep2 = step2 and close > close[1];
def downStep1 = step1 and close < close[1];
def downStep2 = step2 and close < open[1];
 
plot UpStep = (upStep1 or upStep1[-1] or upStep2 or upStep2[-1]) and zigZag == low;
plot DownStep = (downStep1 or downStep1[-1] or downStep2 or downStep2[-1]) and zigZag == high;
 

In my mind, this would be 2 pcfs...one for "Upstep Zig-Zag" and one for "DownStep Zig-Zag."  I have taken the step of converting this easier portion to pcf as follows:

UpStep:

(O1 >= O and
 O >= C1 and
 O1 > C1 and
 C > O1)
OR
(O1 <= O and
 O <= C1 and
 O1 < C1 and
 C > C1)
OR
(O2 >= O1 and
 O1 >= C2 and
 O2 > C2 and
 C1 > O2)
OR
(O2 <= O1 and
 O1 <= C2 and
 O2 < C2 and
 C1 > C2)
 
-----------------


DownStep:

(O1 >= O and
 O >= C1 and
 O1 > C1 and
 C < C1)
OR
(O2 >= O1 and
 O1 >= C2 and
 O2 > C2 and
 C1 < C2)
OR
(O1 <= O and
 O <= C1 and
 O1 < C1 and
 C < O1)
OR
(O2 <= O1 and
 O1 <= C2 and
 O2 < C2 and
 C1 < O2)

 

----------------------------------------------------------------------------------------

This is where things get ugly.  The function called above "ZigZagHighLow" contains this code, which is beyond my time and/or ability to convert.

 

ZigZagHighLow function:
 
 
input priceH = high;
input priceL = low;
input percentageReversal = 5.0;
input absoluteReversal = 0.0;
input atrLength = 5;
input atrReversal = 1.5;
 
Assert(percentageReversal >= 0, "&#39;percentage reversal&#39; must not be negative: " + percentageReversal);
Assert(absoluteReversal >= 0, "&#39;absolute reversal&#39; must not be negative: " + absoluteReversal);
Assert(atrReversal >= 0, "&#39;atr reversal&#39; must not be negative: " + atrReversal);
Assert(percentageReversal != 0 or absoluteReversal != 0 or atrReversal != 0, "Either &#39;percentage reversal&#39; or &#39;absolute reversal&#39; or &#39;atr reversal&#39; must not be zero");
 
def hlPivot;
if (atrReversal != 0) {
    hlPivot = percentageReversal / 100 + WildersAverage(TrueRange(high, close, low), atrLength) / close * atrReversal;
} else {
    hlPivot = percentageReversal / 100;
}
def state = {default init, undefined, uptrend, downtrend};
def maxPriceH;
def minPriceL;
def newMax;
def newMin;
def prevMaxH = GetValue(maxPriceH, 1);
def prevMinL = GetValue(minPriceL, 1);
 
if GetValue(state, 1) == GetValue(state.init, 0) {
    maxPriceH = priceH;
    minPriceL = priceL;
    newMax = yes;
    newMin = yes;
    state = state.undefined;
} else if GetValue(state, 1) == GetValue(state.undefined, 0) {
    if priceH >= prevMaxH {
        state = state.uptrend;
        maxPriceH = priceH;
        minPriceL = prevMinL;
        newMax = yes;
        newMin = no;
    } else if priceL <= prevMinL {
        state = state.downtrend;
        maxPriceH = prevMaxH;
        minPriceL = priceL;
        newMax = no;
        newMin = yes;
    } else {
        state = state.undefined;
        maxPriceH = prevMaxH;
        minPriceL = prevMinL;
        newMax = no;
        newMin = no;
    }
} else if GetValue(state, 1) == GetValue(state.uptrend, 0) {
    if priceL <= prevMaxH - prevMaxH * hlPivot - absoluteReversal {
        state = state.downtrend;
        maxPriceH = prevMaxH;
        minPriceL = priceL;
        newMax = no;
        newMin = yes;
    } else {
        state = state.uptrend;
        if (priceH >= prevMaxH) {
            maxPriceH = priceH;
            newMax = yes;
        } else {
            maxPriceH = prevMaxH;
            newMax = no;
        }
        minPriceL = prevMinL;
        newMin = no;
    }
} else {
    if priceH >= prevMinL + prevMinL * hlPivot + absoluteReversal {
        state = state.uptrend;
        maxPriceH = priceH;
        minPriceL = prevMinL;
        newMax = yes;
        newMin = no;
    } else {
        state = state.downtrend;
        maxPriceH = prevMaxH;
        newMax = no;
        if (priceL <= prevMinL) {
            minPriceL = priceL;
            newMin = yes;
        } else {
            minPriceL = prevMinL;
            newMin = no;
        }
    }
}
 
def barNumber = BarNumber();
def barCount = HighestAll(If(IsNaN(priceH), 0, barNumber));
def newState = GetValue(state, 0) != GetValue(state, 1);
def offset = barCount - barNumber + 1;
def highPoint = state == state.uptrend and priceH == maxPriceH;
def lowPoint = state == state.downtrend and priceL == minPriceL;
 
def lastH;
if highPoint and offset > 1 {
    lastH = fold iH = 1 to offset with tH = priceH while !IsNaN(tH) and !GetValue(newState, -iH) do if GetValue(newMax, -iH) or iH == offset - 1 and GetValue(priceH, -iH) == tH then Double.NaN else tH;
} else {
    lastH = Double.NaN;
}
 
def lastL;
if lowPoint and offset > 1 {
    lastL = fold iL = 1 to offset with tL = priceL while !IsNaN(tL) and !GetValue(newState, -iL) do if GetValue(newMin, -iL) or iL == offset - 1 and GetValue(priceL, -iL) == tL then Double.NaN else tL;
} else {
    lastL = Double.NaN;
}
 
plot ZZ;
if barNumber == 1 {
    ZZ = fold iF = 1 to offset with tP = Double.NaN while IsNaN(tP) do if GetValue(state, -iF) == GetValue(state.uptrend, 0) then priceL else if GetValue(state, -iF) == GetValue(state.downtrend, 0) then priceH else Double.NaN;
} else if barNumber == barCount {
    ZZ = if highPoint or state == state.downtrend and priceL > minPriceL then priceH else if lowPoint or state == state.uptrend and priceH < maxPriceH then priceL else Double.NaN;
} else {
    ZZ = if !IsNaN(lastH) then lastH else if !IsNaN(lastL) then lastL else Double.NaN;
}
ZZ.SetDefaultColor(GetColor(1));
ZZ.EnableApproximation();

 

Many thanks in advance for my friend.  I wish I could give you more background on the usage of this for trading, but it is not my setup.  However, I will ask the original requester to fill in some detail in this thread.

Thanks Bruce and/or any other person that can help!

Topic: Average including sub-periods
Posted: Thursday, February 09, 2017 9:00:15 AM

I am trying to write a pcf that enures a stock has met avg volume requirements overall for a period, as well as during each of several sub-periods.

For example, day I want avg daily vol >= 300k shares over 90 days as well as each 15day sub-period. ( So there were no periods where volume dried up over the 90 days.)

Here is how I approached it.  I would like Bruce (or whoever) to validate my approach or suggest an alternative if something easier or more elegant jumps out at you.  Thanks in advance.

 AVG(AVGV90.90, 15) >= 300000 AND

AVG(AVGV90.75, 15) >= 300000 AND
AVG(AVGV90.60, 15) >= 300000 AND
AVG(AVGV90.45, 15) >= 300000 AND
AVG(AVGV90.30, 15) >= 300000 AND
AVG(AVGV90.15,15)  >= 300000 AND
AVG(AVGV90, 15)      >= 300000
Topic: Is it possible to revert to 12.6 after installing 16/17?
Posted: Wednesday, December 14, 2016 7:04:07 AM

Bruce,

I am considering installing v17 for a test drive.  However, I don&#39;t want to have any hassles should I decide to revert back to using 12.6.

So does the install of v16 or v17 impact the 12.6 installation?

In other words, can I walk it back to 12.6 if that is my preference?

Thanks in advance

Topic: How do I write 34 period XAVG of (H+L+C)/3 in pcf
Posted: Thursday, August 18, 2016 9:09:18 PM

That&#39;s it...thanks diceman!