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

    • Date: 7th April 2025.   Asian Markets Plunge as US-China Trade War Escalates; Wall Street Futures Signal Further Turmoil.   Global financial markets extended last week’s massive sell-off as tensions between the US and its major trading partners deepened, rattling investors and prompting sharp declines across equities, commodities, and currencies. The fallout from President Trump’s sweeping new tariff measures continued to spread, raising fears of a full-blown trade war and economic recession.   Asian stock markets plunged on Monday, extending a global market rout fueled by rising tensions between the US and China. The latest wave of aggressive tariffs and retaliatory measures has unnerved investors worldwide, triggering sharp sell-offs across the Asia-Pacific region.   Asian equities led the global rout on Monday, with dramatic losses seen across the region. Japan’s Nikkei 225 index tumbled more than 8% shortly after the open, while the broader Topix fell over 6.5%, recovering only slightly from steeper losses. In mainland China, the Shanghai Composite sank 6.7%, and the blue-chip CSI300 dropped 7.5% as markets reopened following a public holiday. Hong Kong’s Hang Seng Index opened more than 9% lower, reflecting deep concerns about escalating trade tensions.           South Korea’s Kospi dropped 4.8%, triggering a circuit breaker designed to curb panic selling. Taiwan’s Taiex index collapsed by nearly 10%, with major tech exporters like TSMC and Foxconn hitting circuit breaker limits after each fell close to 10%. Meanwhile, Australia’s ASX 200 shed as much as 6.3%, and New Zealand’s NZX 50 lost over 3.5%.   Despite the escalation, Beijing has adopted a measured tone. Chinese officials urged investors not to panic and assured markets that the country has the tools to mitigate economic shocks. At the same time, they left the door open for renewed trade talks, though no specific timeline has been set.   US Stock Futures Plunge Ahead of Monday Open   US stock futures pointed to another brutal day on Wall Street. Futures tied to the S&P 500 dropped over 3%, Nasdaq futures sank 4%, and Dow Jones futures lost 2.5%—equivalent to nearly 1,000 points. The Nasdaq Composite officially entered a bear market on Friday, down more than 20% from its recent highs, while the S&P 500 is nearing bear territory. The Dow closed last week in correction. Oil prices followed suit, with WTI crude dropping over 4% to $59.49 per barrel—its lowest since April 2021.   Wall Street closed last week in disarray, erasing more than $5 trillion in value amid fears of an all-out trade war. The Nasdaq Composite officially entered a bear market on Friday, sinking more than 20% from its recent peak. The S&P 500 is approaching bear territory, and the Dow Jones Industrial Average has slipped firmly into correction territory.   German Banks Hit Hard Amid Escalating Trade Tensions   German banking stocks were among the worst hit in Europe. Shares of Commerzbank and Deutsche Bank plunged between 9.5% and 10.3% during early Frankfurt trading, compounding Friday’s steep losses. Fears over a global trade war and looming recession are severely impacting the financial sector, particularly export-driven economies like Germany.   Eurozone Growth at Risk   Eurozone officials are bracing for economic fallout, with Greek central bank governor Yannis Stournaras warning that Trump’s tariff policy could reduce eurozone GDP by up to 1%. The EU is preparing retaliatory tariffs on $28 billion worth of American goods—ranging from steel and aluminium to consumer products like dental floss and luxury jewellery.   Starting Wednesday, the US is expected to impose 25% tariffs on key EU exports, with Brussels ready to respond with its own 20% levies on nearly all remaining American imports.   UK Faces £22 Billion Economic Blow   In the UK, fresh research from KPMG revealed that the British economy could shrink by £21.6 billion by 2027 due to US-imposed tariffs. The analysis points to a 0.8% dip in economic output over the next two years, undermining Chancellor Rachel Reeves’ growth agenda. The report also warned of additional fiscal pressure that may lead to future tax increases and public spending cuts.   Wall Street Braces for Recession   Goldman Sachs revised its US recession probability to 45% within the next year, citing tighter financial conditions and rising policy uncertainty. This marks a sharp jump from the 35% risk estimated just last month—and more than double January’s 20% projection. J.P. Morgan issued a bleaker outlook, now forecasting a 60% chance of recession both in the US and globally.   Global Leaders Respond as Trade Tensions Deepen   The dramatic market sell-off was triggered by China’s sweeping retaliation to a new round of US tariffs, which included a 34% levy on all American imports. Beijing’s state-run People’s Daily released a defiant statement, asserting that China has the tools and resilience to withstand economic pressure from Washington. ‘We’ve built up experience after years of trade conflict and are prepared with a full arsenal of countermeasures,’ it stated.   Around the world, policymakers are responding to the growing threat of a trade-led economic slowdown. Japanese Prime Minister Shigeru Ishiba announced plans to appeal directly to Washington and push for tariff relief, following the US administration’s decision to impose a blanket 24% tariff on Japanese imports. He aims to visit the US soon to present Japan’s case as a fair trade partner.   In Taiwan, President Lai Ching-te said his administration would work closely with Washington to remove trade barriers and increase purchases of American goods in an effort to reduce the bilateral trade deficit. The island's defence ministry has also submitted a new list of US military procurements to highlight its strategic partnership.   Economists and strategists are warning of deeper economic consequences. Ronald Temple, chief market strategist at Lazard, said the scale and speed of these tariffs could result in far more severe damage than previously anticipated. ‘This isn’t just a bilateral conflict anymore — more countries are likely to respond in the coming weeks,’ he noted.   Analysts at Barclays cautioned that smaller Asian economies, such as Singapore and South Korea, may face challenges in negotiating with Washington and are already adjusting their economic growth forecasts downward in response to the unfolding trade crisis.           Oil Prices Sink on Demand Concerns   Crude oil continued its sharp slide on Monday, driven by recession fears and weakened global demand. Brent fell 3.9% to $63.04 a barrel, while WTI plunged over 4% to $59.49—both benchmarks marking weekly losses exceeding 10%. Analysts say inflationary pressures and slowing economic activity may drag demand down, even though energy imports were excluded from the latest round of tariffs.   Vandana Hari of Vanda Insights noted, ‘The market is struggling to find a bottom. Until there’s a clear signal from Trump that calms recession fears, crude prices will remain under pressure.’   OPEC+ Adds Further Pressure with Output Hike   Bearish sentiment intensified after OPEC+ announced it would boost production by 411,000 barrels per day in May, far surpassing the expected 135,000 bpd. The alliance called on overproducing nations to submit compensation plans by April 15. Analysts fear this surprise move could undo years of supply discipline and weigh further on already fragile oil markets.   Global political risks also flared over the weekend. Iran rejected US proposals for direct nuclear negotiations and warned of potential military action. Meanwhile, Russia claimed fresh territorial gains in Ukraine’s Sumy region and ramped up attacks on surrounding areas—further darkening the outlook for markets.   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.   Andria Pichidi 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.
    • AMZN Amazon stock watch, good buying (+313%) toi hold onto the 173.32 support area at https://stockconsultant.com/?AMZN
    • META stock watch, local support and resistance areas at 507.48, 557.84 at https://stockconsultant.com/?META
    • TMUS T-Mobile stock, watch for a top of range breakout at https://stockconsultant.com/?TMUS
    • KULR KULR Technology stock watch, pullback to 1.25 triple support area with bullish indicators at https://stockconsultant.com/?KULR
×
×
  • Create New...

Important Information

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