AssignBackgroundColor not working as expected


Category:
0
0

I am trying to make the TTM_ScalperAlert more apparent in my watchlist when it fires.

This is what I am running,

def AlertSig = if (ttm_ScalperAlert().pivotlow[3]) then 1 else 0;
#def AlertSig = if (ttm_ScalperAlert().pivotHigh[3]) then 1 else 0;

plot thing = alertsig;

addlabel(1,AlertSig ,Color.white);

AssignBackgroundColor(if alertsig >0 then color.DARK_GREEN else color.black);

No matter what I try, it never changes the background. It doesn’t even evaluate the else statement.

I do see a 1 printed in the watchlist when the Scalper Alert has fired within the selected period.

Ideally, I would have liked to define,

def AlertSig = if (ttm_ScalperAlert().pivotlow[3]) then 1 else 0;
def AlertSig2 = if (ttm_ScalperAlert().pivotHigh[3]) then 1 else 0;

The compiler throws an exception indicating it might not be reliable with realtime data. Anyway to tell TOS I understand it may have issues, but let me use the script as written?

Thanks for the site and putting out examples. Been very helpful,

Cheers

Marked as spam
Posted by (Questions: 4, Answers: 5)
Asked on October 13, 2017 3:41 pm
682 views
0
Private answer

One quick search on the forum gives you the answer. I searched for the term “scalper” and came up with these two posts:

https://www.hahn-tech.com/ans/how-to-add-audible-alertnotification-to-ttm-scalper-alert/

https://www.hahn-tech.com/ans/how-can-i-incorporate-the-ttm-scalper-signal-into-a-custom-scan/

The short answer is, we can’t get there from here. The TTM Scalper alert is NOT what is seems to be. There is some trickery involved, which makes it completely unfit for generating any sort of signals or alerts.

Marked as spam
Posted by (Questions: 37, Answers: 4086)
Answered on October 13, 2017 7:10 pm
0

Thanks, I did see these. I am wondering why though if I pass the result, which I expected should be a boolean isn’t evaluated in the AssignBackgroundColor instruction. Curiously, it does generate a signal in the Watchlist when it shows on the 3rd or 4th bar in a chart as a 1 in the watchlist, and as a 0 when the condition isn’t true.

I can’t remember the exact statement I used when I was trying to get this to generate a green background, I think it was,
def AlertSig=if ttm_scalperAlert().pivotlow then 1 else 0
plot thing = if alertsig[3] == 1 then low else double.NaN;
thing.SetPaintingStrategy(PaintingStrategy.POINTS);
Instead of getting 1 when condition is true and 0 when condition is not true, it would show real numbers (i.e. 3.37, 22.4) instead of 1 and 0 when condition wasn’t true. This code was offered to me by a contact at TOS.

The way I am using this is a heads up in the watchlist with confirmation by the PPS indicator. Seems to work very well on fast moving stocks. Both indicators (the scalper and PPS) are less effective if the volume isn’t strong (probably true for most indicators I assume). If I had more confidence in my eyes, one could probably guess the price action by simply observing the chart.

( at October 13, 2017 9:15 pm)
0

The problem is that the TTM Scalper indicator makes use of future data bars to create it’s signals. In order to paint a bar to indicate a Scalper alert, the code is starting 3-4 bars back from the last bar on the chart. From that point, 3-4 bars back in history, it is looking forward to see if conditions are present in the next 3-4 bars. So this indicator is virtually useless. I should say it is absolutely worthless, however there are ways you may use it’s higher time frame signals to trade on a lower time frame.

The real problem is the code was written backwards. Instead of starting 3-4 bars in history and looking forward, it should be starting on the last bar on the chart and looking backward 3-4 bars. We don’t have the source code so I can only determine this by observation and testing. One of those tests is one you have already conducted. Which is that it is not possible to get this to work for alerts, on a watchlist or on a custom scan.

If I had access to the source code I could fix this. But I have never found the source code.

Just walk away. Don’t spend anymore time on this. Unless you want to drive yourself crazy.

( at October 13, 2017 10:05 pm)
0
Private answer

As a follow up, I was watching a chart when a the PPSbuy indicator was being painted. I think it was 8 bars back that the TTMScalper was also being painted. I was under the impression that it would be only 3 bars behind before being painted. On a 5 minute chart, 40 minutes seems like a very stale indicator, though it explains why this indicator seems to work really well. Kind of like saying I should have bought a stock X days ago, because look at its price now. This indicator has been tossed now in my Watchlist.

Marked as spam
Posted by (Questions: 4, Answers: 5)
Answered on November 16, 2017 1:02 pm
0

I have personally observed a range of 3-5 bars back for TTM Scalper. Glad you have come to realize it has no value whatsoever. Spread the word! Save others!

( at November 16, 2017 2:11 pm)