Jump to content

Well, Tom Bombadil? Sing us a new song.


Recommended Posts

The following code is Pinescript (you can use it on tradingview.com).  It is the 'famous' 4-9-18 (E)MA crossover strategy.

Quote

//@version=4
strategy("3 MAcross_alert", shorttitle="MAcross_Alert", overlay=true)
EMA_Fast =input(4, minval=1) // To input period for 1st sma, default period set as 10
EMA_Medium =input(9, minval=1)
EMA_Slow =input(18, minval=1)
s1=ema(close,EMA_Fast) // sma values stored in s1 and s2 variables
s2=ema(close,EMA_Medium)
s3=ema(close,EMA_Slow)
plot(s1, color=#2196F3,linewidth=2) // Plots the MA
plot(s2, color=#FF9800,linewidth=2)
plot(s3, color=#9C27B0,linewidth=2)
long= crossover(s1,s2) and s2 > s3 // Define our buy/sell conditions, using pine inbuilt functions.
//long= close > s1 and s1 > s2 and s2 > s3
short= crossunder(s1,s2) and s1 < s2
//short= close < s1 and s1 < s2 and s2 < s3
//exitLong = crossunder(s1,s2)
exitLong= close < s3
exitShort = crossover(s1,s2) and s2 < s3
strategy.entry("long",strategy.long,when=long) // Buys when buy condition met
strategy.close("long",when=exitLong)
strategy.entry("short",strategy.short, when = short ) // Closes position when sell condition met
strategy.close("short",when=exitShort)

 

Try applying it to the various indices on a 15 minute time frame.

For example on the U.S. 30, 15 minute time frame, it gives this:

Net Profit
ALL
$ 2852.40
2.85 %
LONG
$ 3318.70
3.32 %
SHORT
$ 466.30
0.47

 

I did manage to tweak the exit conditions to get this to generate profit going short as well as long but I've forgotten what it was.  Otherwise you would only ever take long trades on this market.

The maximum drawdown was $ 2160.60

The real kicker though, is the equivalent buy and hold profit: $ 25609.35

Interestingly - if you apply it to other indices such as Australia 200 and French 30 the exact same system generates a pure loss (it makes profit on several others)  Hence, the same MAs on the same time frame do not generate results for different securities that are remotely similar.  (So much for the techniques of TA being applicable to everything.)

Link to comment
20 hours ago, dmedin said:

the same MAs on the same time frame do not generate results for different securities that are remotely similar

 

And there's nothing to suggest that these EMAs will keep on working on the DJIA into the future, either. 

So, we have made another discovery: the same TA approach, applied to different markets, different times, or the same market at different times, provides completely different results.  :D 

Link to comment

The search goes on though.  Why?

With buy and hold we typically have to buy an ETF.  There are plenty of S&P 500 ETFs, but few for indices like Nasdaq and Dow Jones.  (I found a good Nasdaq ETF, but it's about $500 for a single share.)

Also, we have no chance of profiting from shorting unless we buy short ETFs, which are probably more arcane and pointless even than spread betting.

Also, we have no exposure to FX or commodities if we buy and hold.  But then again, why should a fat smelly punter sitting at home in his underpants (like me) have 'access' to complex financial instruments in the first place :D 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • General Statistics

    • Total Topics
      21,193
    • Total Posts
      90,728
    • Total Members
      41,302
    • Most Online
      7,522
      10/06/21 10:53

    Newest Member
    KareemKashkush
    Joined 30/01/23 17:29
  • Posts

    • @MongiIG How long does it take to reply to a simple question?
    • Look Ahead to 31/1/23: Big data from the US, China, Japan; PFE, XOM, AMD earnings Ahead of the Fed meeting and the key US jobs report, investors get set to digest retail sales numbers from Germany and Japan. Plus, look out for consumer-related data from China, France, and the US. Earnings see Pfizer (PFE), Exxon Mobil (XOM) and Advanced Micro Devices (AMD) hand in their Q4 report cards.   Angeline Ong | Presenter, Analyst and Content Editor, London | Publication date: Monday 30 January 2023        
    • Crude declines make little difference for FTSE oil & gas producers, with the long-term view remaining bullish for energy Source: Bloomberg   Commodities Petroleum Petroleum industry Brent Crude Gas Market trend  Joshua Mahony | Senior Market Analyst, London | Publication date: Monday 30 January 2023  Crude declines see Brent lose 34% Crude oil has suffered substantial losses over the course of the past year, with brent currently trading 34% below the March 2022 peak of $131.51. This decline represents grounds for optimism on the inflation-front, with headline CPI sliding lower across Europe and the US. However, traders continue to wonder whether this move will represent the top for the market or simply a temporary pullback within a long-term uptrend. Key considerations for the bulls include the re-emergence of Chinese economic activity as Covid restrictions are withdrawn, set against the risk of declining demand as recessionary pressures take hold. Looking at the monthly Brent crude chart below, we can see that this current month looks to be closing out in a doji candle, marking a second consecutive month of indecision. Meanwhile, the stochastic oscillator appears to be tightening, signalling the potential for a bullish shift in momentum before too long. With price currently trading around the 76.4% Fibonacci support level, the bulls will hope that the long-term uptrend will soon kick back into play. Source: ProRealTime SPR back down to multi-decade lows Another aspect to consider comes from the US, who have been drawing down their strategic petroleum reserve in a bid to support prices as OPEC restrict output. That decline in reserves can only last so long, with current levels back down to the lowest point since 1983. Recent comments have signalled that the US could move to instead seek to top-up their reserves around the $70 mark. Could a shift from supplier to consumer help tip sentiment back in favour of the bulls? FTSE oil & gas producers outperform One interesting area of outperformance has been the relative strength of oil producing stocks despite this decline in crude prices. Thus far, we have largely seen producers continue their ascent, with the volatility in oil and gas prices doing little to stifle sentiment. However, the chart below highlights how the FTSE 350 oil & gas producers sector essentially provides a more stable play on energy prices, with the stocks largely reflecting the underlying trend without necessarily seeing the same major swings that can occur for crude. The pullback we have seen in Brent (blue line) thus brings the total gains over the past two-years down to the area seen for FTSE 350 producers. For now, the uptrend remains in play for the sector, thus highlighting the belief that this recent pullback in energy prices serves to reflect a reversion back into the mean uptrend. With that in mind, the weakness seen in energy prices, and consolidation in FTSE oil & gas stocks, is deemed a potential precursor to another move higher to continue the long-term uptrend. Source: ProRealTime
×
×
  • Create New...