// ------------------------------------------------------------------------ // MACDZ Component Mapping (Aligned with PRT Chart Labels): // - MACD Zero Lag → myMACDline (Blue Line) // - Zero Lag Signal → myMACDsignal (Red Line) // - MACD - Signal → Histogram (Green Histogram = myMACDline - myMACDsignal) // ------------------------------------------------------------------------ // OPTIMIZATION RANGES: // - R1: myMACDFast → Short-term EMA // - R2: myMACDSlow → Long-term EMA // - R3: myMACDSignal → Signal EMA applied to MACD line // ======================================================================== // === INPUT PARAMETERS === myMACDFast = myMACDFast // R1: Short-term EMA myMACDSlow = myMACDSlow // R2: Long-term EMA myMACDSignal = myMACDSignal // R3: Signal EMA myATRperiod = 14 myATRmultiplier = 2.5 myRiskPercent = 5 myInitialBalance = 100000 // === INDICATORS === myMACDline = ExponentialAverage[myMACDFast](close) - ExponentialAverage[myMACDSlow](close) myMACDsignal = ExponentialAverage[myMACDSignal](myMACDline) myATR = AverageTrueRange[myATRperiod] // === ENTRY SIGNALS === // Detect actual crossover on previous bar and act on current bar myLongSignal = myMACDline[1] <= myMACDsignal[1] AND myMACDline > myMACDsignal myShortSignal = myMACDline[1] >= myMACDsignal[1] AND myMACDline < myMACDsignal // === EXIT SIGNALS === // Detect crossover in reverse direction to close position on the same bar myExitLongSignal = myMACDline[1] >= myMACDsignal[1] AND myMACDline < myMACDsignal myExitShortSignal = myMACDline[1] <= myMACDsignal[1] AND myMACDline > myMACDsignal Hi there buddy PRT coders. I am having alignment issues with MACDZ and the actual trade entry on the price chart. Panel = variables: makes clear and correct trade entry and exit, as per the actual (stated above) green peak = long trade entry red peak = short trade entry black shape -1 = stop loss hit black shape +1 = opposite signal hit see attached images, there is a clear mis-alignment of the MACDZ no matter the param values I use. Also attached is param variable for said MACDZ Code snippets pasted, as coded… Any guidance on this is very much appreciated, as always. NT BTW: we really need to use discord… it is so much easier to use, to share code, chat, links to chat, upload files etc…. !!! and so very easy to manage…. 🙂