Half Trend Scalper Indicator for ThinkorSwim

M

manishji

New member
Also, does anyone know how to get rid of the shares, return, win count etc labels from the top of the chart?

Take out this section to remove those lables.

Code:
#Daily profit
def Midnight = if Active then FPL else Midnight[1];
def DaysProfit = FPL - Midnight;


#Plots
AddChartBubble(!hideFPL and showEntryBubbles and isEntryBar, FPL, "Entry: " + entryBarPL + " | " + bn, Color.BLUE);
AddChartBubble(!hideFPL and showEntryBubbles and isExitBar, FPL, "Exit: " + exitBarPL,
               color = if isWin
                       then GlobalColor("LabelGreen")
                       else if isLoss
                       then Color.DARK_RED
                       else Color.GRAY,
               up = no
              );

#Labels

AddLabel(yes,
         text = "Total Trades: " + entryCount,
         color = Color.gray
         );

AddLabel(yes,
         text = "WinCount: " + winCount +
                " | LossCount: " + lossCount +
                " | WinRate: " + winRate,
         color = if winRate >= targetWinRate
                 then GlobalColor("LabelGreen")
                 else Color.RED
         );

AddLabel(yes,
         text = "W/L: " + AsPercent(winLossRatio),
         color = if winLossRatio > targetWinLoss
                 then GlobalColor("LabelGreen")
                 else Color.RED
         );

AddLabel(yes,
        text = "HighestReturn: " +  AsDollars(highestReturn),
        color = if highestReturn > 0
                then GlobalColor("LabelGreen")
                else Color.RED
        );

AddLabel(yes,
        text = "LowestReturn: " +  AsDollars(lowestReturn),
        color = if lowestReturn > 0
                then GlobalColor("LabelGreen")
                else Color.RED
        );


AddLabel(yes,
         text = "P&L High" +
                (if enableDebugging
                then " at bar " + highBarNumber
                else "") +
                ":  " + AsDollars(highFPL),
        color = GlobalColor("LabelGreen")
       );

AddLabel(yes,
         text = "P&L Low" +
                (if enableDebugging
                then " at bar " + lowBarNumber
                else "") +
                ":  " + AsDollars(lowFPL),
        color = Color.RED
       );
 
  • Like
Reactions: DPM
C

csrkk

New member
VIP
@csrkk how would you backtest Trend Scalper with Trend Pivot indicator, if Trend Pivot indicator is repainting constantly?
Yes, that's true. My bad. Most of the time, the first Up arrow that show up after painting should give a good indication. Still working on it.
 
MerryDay

MerryDay

Active member
VIP
So so sorry... I never use "open" in my AddOrders; that will always give unrealistic numbers...
 
D

DPM

New member
VIP
@manishji Thank you

@MerryDay Sorry -- my mistake. I didn't mean the code didn't transfer. It did via the link. I meant to ask for the code pasted so I could delete the lines that pertain to the p&l labels so I can remove them while trading.

I have a couple other questions if you don't mind.

I trade ES on a 5 min. When I add your rewritten indicator to backtest it, it shows up as pictured in the imagur link.

The "shares to buy" label says 1. Since this is a future, is the p&l math according to 1 contract?

Also, under the "buy" arrows, what does the 3 and (150) refer to?

Thank you from a fellow Long Islander (now Rhode Islander).

 
Last edited by a moderator:
B

Bobbydigital83

New member
VIP
I once met some anti-infrastructure groups who believe there are to many people in the world; I was a presenter about toxic byproducts at some environmental conference... In Q&A I just fell back to my references that state it isn't the number of people in the world that determines the damage but the nature of chemicals. I was paid by the army so I probably do need to balance away from Fascism, we see so much fascism now mostly centered on de-mobilizing people.

We don't see "so much" fascism. Your a librarian...read a history book to learn that humans are at the least amount of despair and self conflict than ever in all of human history.

(Btw, I used to be a librarian back in my late high school and early college days).
 
MerryDay

MerryDay

Active member
VIP
DPM The "shares to buy" is for equities. It is the tradesize based on $6000 lots. The number under the buy arrow is the tradeSize values
 
  • Like
Reactions: DPM
K

krsheath

New member
VIP
Hello - Can some one help me setup a scanner for upsignal - I've tried many things like when upsignal is true or cross above 1 bar alert me and nothing is showing in my watchlist. I've tried many diff variations.
 
K

krsheath

New member
VIP
@sbwcws What you posted is essentially the same. I suspect just different settings, and I also notice an MTF version.

Hey @BenTen - Can we add MTF into this to make this more powerfull.
 
D

DPM

New member
VIP
@BenTen Gave this a run today and I liked it quite a bit. I trade E-mini futures on a 5 min frame for my entries. The only drawback is it's extremely sensitive. For instance, it'll flash a buy after a candle close, then a sell a couple candles later and the price hasn't really moved much. Is there a setting where I can sort of desensitize it?
 
K

krsheath

New member
VIP
@BenTen Gave this a run today and I liked it quite a bit. I trade E-mini futures on a 5 min frame for my entries. The only drawback is it's extremely sensitive. For instance, it'll flash a buy after a candle close, then a sell a couple candles later and the price hasn't really moved much. Is there a setting where I can sort of desensitize it?

WHen I am playing future - I normally use 5 MIN - as it move so faaaast - It's not even funny - 1 MIN is too RISKY. As any ALGO or News can change the entire pattern
 
Last edited:
BenTen

BenTen

Administrative
Staff
VIP
@petey150 You can't set up a scanner for this indicator. I'm not sure why, maybe due to its complexity, but the indicator will break your ToS if you try to scan it.
 
P

petey150

New member
@BenTen could you make so it creates alerts when the trend reversal happens?
 
L

LLSxCLC

New member
Hey @BenTen Sorry if this is a dumb question as I don't fully understand how this indicator works. But any idea why the Half Trend line will sometimes "freeze"? Looks like it just stops moving with price action and just stays as a straight line across. Generally, removing the indicator and then adding it back will solve the problem. But this solution doesn't work when it starts to freeze at/near market open, which makes me wonder does the indicator weight pre-market price action differently or something? Any advice is greatly appreciated!
 
BenTen

BenTen

Administrative
Staff
VIP
@LLSxCLC I don't think it was freezing; if you observe the indicator from the past, it doesn't move like a moving average. If the stock isn't moving in a strong uptrend or downtrend, you're likely to see small movement in the line. Does that make sense? You can also disable extended hours on your chart for further testing.
 
L

LLSxCLC

New member
@BenTen I understand, thank you! However, in this case, I actually do believe the line is freezing in some cases because when I remove the indicator and then re-add it, it fixes the "frozen" line so I'm pretty confused lol. I'll upload a screenshot so you can get a better idea.

Well I tried Inserting the image, but it's not working so this is the link.



As you can see starting at the 11:03 candle, the Half Trend line stays flat despite the large move down.

And this is how it looks after I "fixed" it by removing and re-adding the indicator.

 
Last edited by a moderator:

Similar threads

Top