NexusFi: Find Your Edge


Home Menu

 





Newbie - multi time frame strategy, appreicate any help


Discussion in MultiCharts

Updated
    1. trending_up 2,815 views
    2. thumb_up 4 thanks given
    3. group 3 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread

Newbie - multi time frame strategy, appreicate any help

  #1 (permalink)
askinleung
Hong Kong China
 
Posts: 1 since Jun 2020
Thanks Given: 0
Thanks Received: 0

Dear all, am new to MC.
I am trying to build a test strategy that look at 1H MACD and 5H MACD.
I have Data#1 as 1H and Data#2 as 5H and I am trying to use the BarsOfData(2) to access the 5H prices and feed it to the MACD function. Bu

However, I do not seem to be able to replicate the same MACD value as the MACD plot on the 5H if I set this indicator to run on data#1 (through the indicator properties, though the code reference to barsOfData(2).
and I will get the same correct result if I set this indicator to run on data#2 through the indicator properties.

Obviously, I need it to run on data#1 on the indicator properties as I will add code pieces to reference to the 1H MACD as well. But I got stuck with getting the right 5H MACD through the BarsOfData(2). Or is it a complete incorrect way of implementing multi time frame indicator/strategy? Appreciate any help/pointers. a quick example would be fantastic!

Thanks a lot!
Leung

---------------------------------------------------------

using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;

namespace PowerLanguage.Indicator{
public class Debug2 : IndicatorObject {
public Debug2(object _ctx):base(_ctx)
{


MACDLength = 9;
MACDslowLength = 26;
MACDfastLength = 12;


}
private IPlotObject DebugI;
//private IPlotObject DebugI2;

// Tech Function
//DMI
//private DirMovement m_dirmovement1;

//MACD
private Function.MACDBarsOfData m_macd1;
private Function.XAverageBarsOfData m_xaverage1;
private VariableSeries<Double> m_mymacd;
private VariableSeries<Double> m_macddiff;

//Var
public ISeries<Double> price { get; set; }


[Input]
public int MACDLength { get; set; }
[Input]
public int MACDfastLength { get; set; }
[Input]
public int MACDslowLength { get; set; }


private double lastpx;
private string Last5HBar;
protected override void Create() {
// create variable objects, function objects, plot objects etc.


m_macd1 = new Function.MACDBarsOfData(this);
m_xaverage1 = new Function.XAverageBarsOfData(this);
m_mymacd = new VariableSeries<Double>(this);
m_macddiff = new VariableSeries<Double>(this);




DebugI =
AddPlot(new PlotAttributes("Signal", 0, Color.Silver,
Color.Empty, 0, 0, true));


}
protected override void StartCalc() {

var B1 = Bars;

var B2 = BarsOfData(2);



if (B2.Status == EBarState.Close)
{



m_macd1.Price =B1.Close;
m_macd1.FastLength = MACDfastLength;
m_macd1.SlowLength = MACDslowLength;
m_xaverage1.Price = m_mymacd;
m_xaverage1.Length = MACDLength;
m_mymacd.DefaultValue = 0;
m_macddiff.DefaultValue = 0;

}



// assign inputs
}
protected override void CalcBar(){
// indicator logic
double power = 0;

if (BarsOfData(2).Status == EBarState.Close)
{


m_mymacd.Value = m_macd1[0];
var m_macdavg = m_xaverage1[0];
m_macddiff.Value = m_mymacd.Value - m_macdavg;


}
//else
DebugI.Set(0,m_mymacd.Value);//,pl_col);





}
}
}

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Better Renko Gaps
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
36 thanks
Tao te Trade: way of the WLD
24 thanks
Spoo-nalysis ES e-mini futures S&P 500
21 thanks
Bigger Wins or Fewer Losses?
19 thanks
GFIs1 1 DAX trade per day journal
16 thanks
  #2 (permalink)
 
forgiven's Avatar
 forgiven 
Fletcher NC
Market Wizard
 
Experience: Intermediate
Platform: nijia trader
Broker: A.M.P. I.Q. ....C.Q.G.
Trading: ym es
Frequency: Every few days
Duration: Days
Posts: 862 since Mar 2012
Thanks Given: 287
Thanks Received: 580

the cross over stuff works best when there is a strong trend in place and your trading in that direction . if your system can not I.D. the trend and direction your pissing in the wind . when the market is trading in a range ... about 70% of the time, the false cross overs will blow you clean out of the water. hope it helps

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #3 (permalink)
Ozquant
Brisbane Queensland Australia
 
Posts: 220 since Aug 2017
Thanks Given: 167
Thanks Received: 380



forgiven View Post
the cross over stuff works best when there is a strong trend in place and your trading in that direction . if your system can not I.D. the trend and direction your pissing in the wind . when the market is trading in a range ... about 70% of the time, the false cross overs will blow you clean out of the water. hope it helps

Spot on MACD and most generic indis are lagging POS . There is a reason most " systems " traders fail and its the tools in your toolbox . If it doesnt work for anyone else why would it work for ' you ' Become a toolmaker not a tool buyer

Reply With Quote
Thanked by:




Last Updated on June 23, 2020


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts