Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

J-S

Trend Indicator for TS?

Recommended Posts

Hi! First time poster here. I'm looking for something for TradeStation in which I can define a trend and have it tell me when one is in place. For example, let's say 4 full points in the ES (16 ticks) WITHOUT a 6-tick retracement. Does anything like that exist? Thanks.

Share this post


Link to post
Share on other sites

Hi Blu-Ray,

 

Agreed, but I don't really know what to take a picture of here. Really, any strong trend would do it. You know, just a trend not really broken up by any substantial retracements.

Share this post


Link to post
Share on other sites

J-S

 

I think the main question would be what criteria you are after to define an uptrend, eg higher highs and higher lows, higher highs only, or consecutive higher closes etc........ if so how many bars..........

 

This would need to be worked out for it to be put into a TS code and that was the reason I was asking for a couple of pics to see what you mean.

 

Hope this helps

 

Blu-Ray

Share this post


Link to post
Share on other sites

Ah, okay. Well, how about this. Simply the distance between the lowest low of a trend (uptrend, obviously) to the highest high. That is, let's say the ES goes from a low point of 1400.00 to a high point of 1404.00 WITHOUT ever retracing 6 ticks (say, from 1403.00 down to 1401.50, and then back up again to 1404.00). Does that help? Thanks again.

Share this post


Link to post
Share on other sites
  J-S said:
Ah, okay. Well, how about this. Simply the distance between the lowest low of a trend (uptrend, obviously) to the highest high. That is, let's say the ES goes from a low point of 1400.00 to a high point of 1404.00 WITHOUT ever retracing 6 ticks (say, from 1403.00 down to 1401.50, and then back up again to 1404.00). Does that help? Thanks again.

 

Apologies in advance, but how are you defining an uptrend ?

 

I'll have a look into after hours, but if you can post a pic it would really help.

 

In the meantime if anyone else comes forward............

 

Cheers

 

Blu-Ray

Share this post


Link to post
Share on other sites

Hi. Well, I define an uptrend, for the sake of this conversation anyway (and what I'm looking for from a code), just as I described it in that last post. I just used the word uptrend to distinguish it from the opposite -- obviously a downtrend. For that, everything would simply be the opposite -- from 1404 down to 1400. Thanks.

Share this post


Link to post
Share on other sites

Here are some trend threads on TS to get a better idea of how to define a trend : https://www.tradestation.com/Discussions/Topic.aspx?Topic_ID=30732

https://www.tradestation.com/discussions/topic.aspx?topic_id=30775

 

A lot of smarter traders than you and I have tried to define it and in the above threads you have mmillar, Bamboo, ghkramer, waynechem and others trying to do so. There is really no need to start your own new definition of trend when the market is full of traders following each other in these definitions.

 

If you want a short summary, here it is:

1. about half the market is looking at a moving average trend

2. the other half may be looking at some trend lines (or zigzags, similar idea).

3. the calculation of trends can be made more precise by using the average true range function (ATR). The market often trades with an ATR stop. In practice, a trend would often stall or ends once the ATR trailing stop is hit.

 

If you like the idea of following a moving average trend, the following waynechem indicator based on calculating the area under the trending moving averages may be a start:

{ TrendArea Indicator  WAV 9/15/04 } 

inputs: ThresholdArea(1500); 

vars: BarCount(0),SlowMA(0),FastMA(0), 
color(0),area(0); 

SlowMA = average(close,15); 
FastMA = average(close,5); 

{ see if we have a new possible trend starting } 
if FastMA crosses above SlowMA or 
  FastMA crosses below SlowMA then 
begin 
  BarCount = 0; 
  area = 0; 
end; 

{ increment BarCount +1 if FastMA above SlowMA... 
 decrement BarCount -1 if FastMA below SlowMA} 
BarCount = IFF(FastMA > SlowMA,BarCount + 1,BarCount); 
BarCount = IFF(FastMA < SlowMA,BarCount - 1,BarCount); 

{ multiply each individual area by its barcount } 
area = area +  AbsValue(BarCount) * (FastMA - SlowMA); 

color = IFF(BarCount > 0,green,cyan); 
color = IFF(BarCount < 0,red,color); 

plot1(area,"Area",color); 
plot2(0,"zero line"); 
plot3(ThresholdArea,"+Thresh"); 
plot4(-ThresholdArea,"-Thresh"); 

Share this post


Link to post
Share on other sites

Well, thanks, but I think everyone here is getting a bit sidetracked by trying to determine what is or isn't a trend. Really, the only definition I'm interested in is the one I defined -- 4 full points on the ES in one direction (doesn't matter which) without a 6 tick retracement in the midst of that trend. That's not something I made up -- the system I'm trading has a higher probability of working by not trading a reversal of such a trend. I don't expect there to be anything with those exact parameters, of course. I was just hoping there might maybe be a code in which I could just plug in those numbers. For all I know, it's a ridiculous question. I'm still fairly new to trading, and even newer to TradeStation (I had used Sierra Chart before). Furthermore, I know NOTHING about coding! The only reason I think it might NOT be a ridiculous question is that I've already found myself amazed at what's out there, and what's possible even if not yet out there. Hope that clears things up! Thanks again.

Share this post


Link to post
Share on other sites

Just one more thought on this, by the way. From the still relatively little I know about TradeStation, I get the feeling that if such a thing does in fact exist, it might be in the form of a "show me" dot type-thing rather than an indicator. You know -- as in when such a trend is in place, a dot appears.

Share this post


Link to post
Share on other sites
  J-S said:
Well, thanks, but I think everyone here is getting a bit sidetracked by trying to determine what is or isn't a trend. Really, the only definition I'm interested in is the one I defined -- 4 full points on the ES in one direction (doesn't matter which) without a 6 tick retracement in the midst of that trend. That's not something I made up -- the system I'm trading has a higher probability of working by not trading a reversal of such a trend. I don't expect there to be anything with those exact parameters, of course. I was just hoping there might maybe be a code in which I could just plug in those numbers. For all I know, it's a ridiculous question. I'm still fairly new to trading, and even newer to TradeStation (I had used Sierra Chart before). Furthermore, I know NOTHING about coding! The only reason I think it might NOT be a ridiculous question is that I've already found myself amazed at what's out there, and what's possible even if not yet out there. Hope that clears things up! Thanks again.

 

J-S

 

Thrunner has posted some excellent material for you, but you seem to have dismissed it. I don't mind coding something up for you, but what you're describing without a pic doesn't make sense, as you can see in my chart below all 4 point moves are not equal.

 

attachment.php?attachmentid=5692&stc=1&d=1206575265

 

Now seriously, I've asked 3 times for you to post a chart, but nothing yet, you keep saying just a 4 point move without a 6 tick retracement.

 

Heres the code you're after but it's missing a vital part:

 

Inputs:

UpColor( Green ),DownColor ( Red);

 

Condition1 = UpTrend { this being your version of an uptrend, eg 3 higher highs or 3 higher closes, or 3 closes above a moving average, above ATR.....etc }

Condition2 = DownTrend { Opposite criteria for uptrend }

 

If Condition1 then Plot1(high,"UpTrend", UpColor);

If Condition2 then Plot2(Low,"DownTrend", DownColor);

 

Cheers

 

Blu-Ray

4pointmoves.png.8365482cf458c161a0e6a09345598074.png

Share this post


Link to post
Share on other sites

Blu Ray,

 

First, just a few comments. Believe me, I NEVER expected you or anyone else here to actually code anything for me! I just thought that someone might know of something in the universe of TS codes out there that might fit the description of what I'm looking for. I'm TRULY grateful! I wish you would have made that clear, though. The fact is, I've never (believe it or not) taken a screenshot of TS before. At first it wasn't uploading to this forum properly. Finally I tried saving the image as a jpeg instead of a bitmap file and now it seems to have worked. I just thought that a good description would be as good as an image, but I guess you feel otherwise. But again, had I known that you were actually going to attempt to code something, I would have acted differently.

 

Also, I have no doubt that Thrunner's information is, yes, excellent, and it wasn't my intention to dismiss it. It's just that I try to trade (like, I would think, most serious traders) very rule-based, and this definition of a trend fits my rules. I'm not saying that others aren't valid -- they're just not mine. Please keep in mind that what I'm trying to do here, in labeling these trends, is to disqualify potential trades without having to take the time to actually "count" the trend -- obviously very hard to do in a fast-moving market.

 

Anyway, the good news is that I found a perfect pic for you! As you'll see from my annotations on the actual chart, the upmove on the left does NOT constitute a trend according to my rules because the six-tick retracement prevents it from being one. The downmove on the right IS a trend, as there is no six-tick retracement. By the way, you'll notice that my bars are of a much shorter timeframe (well, volume level, actually) than the ones in your image. I suppose it doesn't really make a difference in the actual calculation, but it's certainly clearer visually when there are more bars involved. Maybe that's part of the confusion here. So, finally, here's the chart! Thanks again.

TrendPic.thumb.jpg.d4ef29370cb6781f94fd5d905433683d.jpg

Share this post


Link to post
Share on other sites

Thanks for the chart J-S.

 

The reason I asked for a chart is, as we all know, you can look at a chart and say " it's in an uptrend", but putting that into coding language is not so straight forward. Let me explain using your chart.

 

You could go for, for example, 3 higher highs.........so the code would be

 

if H > H[1] and H > H[2] and H > H[3] then plot............

 

but using your chart it would stop where I've marked A.

 

Alternatively you could use the code so if the high is higher or equal to previous bar, this would get you above A, but it would also signal an uptrend at B for example.

 

You could then move on to higher highs and higher lows and this would again stop at A.

 

You could then do as above so the high and low are greater or equals to the previous, but realise that could result in C.

 

Another thing that you might ( edit: you will ) find is that where I've marked D. for example if that low was 1 tick above the previous low then your downtrend is invalidated ( via the code ) but you're still clearly in a downtrend.

 

Basically what I'm trying to point out is that although visually we can spot a trend, but putting that into code needs criteria.

 

Hope this helps

 

Blu-Ray

 

attachment.php?attachmentid=5696&stc=1&d=1206612780

JS_Chart.thumb.png.0ba93919ee704e8a6a6d454bec204334.png

Share this post


Link to post
Share on other sites

J-S on your chart the downtrend is over almost as soon as it starts. You don't know it is a downtrend until it has moved 4 points right? A point later price retraces 6+ ticks so its finished.

 

There are much better ways of determining trend imho that you can see instantly just using price action. Is price making higher highs higher lows and higher closes? Is it leaving higher swing highs and swing lows? etc. Thats just my opinion each to there own of course:D

 

You might want to check out Clyde Lee's website the swing machine he has a tradestation function called swingleeII (from memory) that is freely given and has many user inputs and options to determine swing points. It will plot a zigzag swing to swing I think too. Actually i believe most zigzag indicators will do what you require with little or no modification.

 

Cheers.

Share this post


Link to post
Share on other sites

Okay, this is obviously more difficult than I thought. Or, maybe I should say, than I had hoped! I'm going to have to take some time to digest all of this after-hours. I'm kind of getting the feeling that what I want is not possible -- indefinable by code.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Topics

  • Posts

    • AMZN Amazon stock, nice buying at the 187.26 triple+ support area at https://stockconsultant.com/?AMZN
    • DELL Dell Technologies stock, good day moving higher off the 90.99 double support area, from Stocks to Watch at https://stockconsultant.com/?DELL
    • MCK Mckesson stock, nice trend and continuation breakout at https://stockconsultant.com/?MCK
    • lmfx just officially launched their own LMGX token, Im planning to grab a couple of hundred and maybe have the option to stake them. 
    • Date: 2nd April 2025.   Market on Edge: Tariff Announcement and Volatility Ahead!   The US economic and employment data continues to deteriorate with the job vacancies figures dropping to a 5-month low. In addition to this, the IMS Manufacturing PMI also fell below expectations. However, both the US Dollar and Gold declined simultaneously following the release of the two figures, an uncommon occurrence in the market. Traders expect a key factor to be today’s ‘liberation day’ where the US will impose tariffs on imports. USDJPY - Traders Await Tariff Confirmation! Traders looking to determine how the USDJPY will look today will find it difficult to determine until the US confirms its tariff plan. Today is the day when Trump previously stated he would finalize and announce his tariff plan. The administration has not yet released the policy, but investors expect it to be the most expansionary in a century. President Trump is due to speak at 20:00 GMT. On HFM's Calendar the speech is stated as "US Liberation Day Tariff Announcement". Currently, analysts are expecting Trump’s Tariff Plan to impose tariffs on the EU, chips and pharmaceuticals later today as well as reciprocal tariffs. Economists have a good idea of how these tariffs may take effect, but reciprocal tariffs are still unspecified. In addition to this, 25% tariffs on the car industry will start tomorrow. The tariffs on the foreign cars industry are a factor which will particularly impact Japan. Although, traders should note that this is what is expected and is not yet finalised. Last week, President Trump stated that he would implement retaliatory tariffs but allow exemptions for certain US trade partners. Treasury Secretary Mr Bessent and National Economic Council Director Mr Hassett suggested that the restrictions would primarily target 15 countries responsible for the bulk of the US trade deficit. However, yesterday, Trump contradicted these statements, asserting that additional duties would be imposed on any country that has implemented similar measures against US products. The day’s volatility will depend on which route the US administration takes. The harshness of the policy will influence both the Japanese Yen as well as the US Dollar.   USDJPY 5-Minute Chart   US Economic and Employment Data The JOLT Job Vacancies figure fell below expectations and is lower than the previous month’s figure. The JOLT Job Vacancies read 7.57 million whereas the average of the past 6 months is 7.78 million. The ISM Manufacturing Index also fell below the key level of 50.00 and was 5 points lower than what analysts were expecting. The data is negative for the US Dollar, particularly as the latest release applies more pressure on the Federal Reserve to cut interest rates. However, this is unlikely to happen if the trade policy ignites higher and stickier inflation. In the Bank of Japan’s Governor's latest speech, Mr Ueda said that the tariffs are likely to trigger higher inflation. USDJPY Technical Analysis Currently, the Japanese Yen Index is the worst performing of the day while the US Dollar Index is more or less unchanged. However, this is something traders will continue to monitor as the EU session starts. In the 2-hour timeframe, the USDJPY is trading at the neutral level below the 75-bar EMA and 100-bar SMA. The RSI and MACD is also at the neutral level meaning traders should be open to price movements in either direction. On the smaller timeframes, such as the 5-minute timeframe, there is a slight bias towards a bullish outcome. However, this is only likely if the latest bearish swing does not drop below the 200-Bar SMA.     The key resistant level can be seen at 150.262 and the support level at 149.115. Breakout levels are at 149.988 and 149.674. Key Takeaway Points: Job vacancies hit a five-month low, and the ISM Manufacturing PMI missed expectations, adding pressure on the Federal Reserve regarding interest rate decisions. Traders await confirmation on Trump’s tariff policy, which is expected to impact the EU, chips, pharmaceuticals, and foreign car industries. The severity of the tariffs will influence both the JPY and the USD, with traders waiting for final policy details. The Japanese Yen Index is the worst index of the day while the US Dollar Index is unchanged. Always trade with strict risk management. Your capital is the single most important aspect of your trading business.   Please note that times displayed based on local time zone and are from time of writing this report.   Click HERE to access the full HFM Economic calendar.   Want to learn to trade and analyse the markets? Join our webinars and get analysis and trading ideas combined with better understanding of how markets work. Click HERE to register for FREE!   Click HERE to READ more Market news.   Michalis Efthymiou HFMarkets   Disclaimer: This material is provided as a general marketing communication for information purposes only and does not constitute an independent investment research. Nothing in this communication contains, or should be considered as containing, an investment advice or an investment recommendation or a solicitation for the purpose of buying or selling of any financial instrument. All information provided is gathered from reputable sources and any information containing an indication of past performance is not a guarantee or reliable indicator of future performance. Users acknowledge that any investment in Leveraged Products is characterized by a certain degree of uncertainty and that any investment of this nature involves a high level of risk for which the users are solely responsible and liable. We assume no liability for any loss arising from any investment made based on the information provided in this communication. This communication must not be reproduced or further distributed without our prior written permission.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.