The Most Robust Intermarket System - Copper

IWM_Barchart_Interactive_Chart_08_13_2023.png

Copper (hg, cash) vs Russell 2000
Copper is heading South.
 
Here’s the file, I can’t attach it to the original post, I think 24h later it doesn’t allow editing. Thanks for the post piezoe!
From my very limited knowledge of AmiBroker Formula Language (AFL) and Spanish, I think the logic from the comment for the original code at the end is
Code:
if in long trade
    if close(intermarketAsset) > SimpleMovingAverage(intermarketAsset, 4)
    and close(tradingAsset) > SimpleMovingAverage(tradingAsset, 4)
        exit long at next bar open
if in short trade
    if close(intermarketAsset) < SimpleMovingAverage(intermarketAsset, 4)
    and close(tradingAsset) < SimpleMovingAverage(tradingAsset, 4)
        exit short at next bar open

if close(intermarketAsset) < SimpleMovingAverage(intermarketAsset, 4)
and close(tradingAsset) < SimpleMovingAverage(tradingAsset, 4)
    enter long tradingAsset at next bar open

if close(intermarketAsset) > SimpleMovingAverage(intermarketAsset, 4)
and close(tradingAsset) > SimpleMovingAverage(tradingAsset, 4)
    enter short tradingAsset at next bar open
 
From my very limited knowledge of AmiBroker Formula Language (AFL) and Spanish, I think the logic from the comment for the original code at the end is
Code:
if in long trade
    if close(intermarketAsset) > SimpleMovingAverage(intermarketAsset, 4)
    and close(tradingAsset) > SimpleMovingAverage(tradingAsset, 4)
        exit long at next bar open
if in short trade
    if close(intermarketAsset) < SimpleMovingAverage(intermarketAsset, 4)
    and close(tradingAsset) < SimpleMovingAverage(tradingAsset, 4)
        exit short at next bar open

if close(intermarketAsset) < SimpleMovingAverage(intermarketAsset, 4)
and close(tradingAsset) < SimpleMovingAverage(tradingAsset, 4)
    enter long tradingAsset at next bar open

if close(intermarketAsset) > SimpleMovingAverage(intermarketAsset, 4)
and close(tradingAsset) > SimpleMovingAverage(tradingAsset, 4)
    enter short tradingAsset at next bar open
Any chance you can post the whole code?
My old AB is shut down/redundant on a no longer used puter.
 
Back
Top