Rules for the Original Indicator Goal To plot the variable Ratio into a chart for day trading. Formulae Ratio = (Var % Symbol 1 + p*(Var % Symbol 2)) * 100 .................... p is a real variable. Var % Symbol 1 = (Current Close Price) / Previous Day Close - 1 Var % Symbol 2 = (Current Close Price) / Previous Day Close - 1 Variable Ratio inserted in Symbol 2 candlestick chart. It is to be displayed in a subwindow. Note that we use the Previous Day Close, not the Previous Bar Close, for any time frame. It is a Day Trade Indicator. It is also to do a first difference indicator, D1, and a second difference indicator, D2, plotted into two separate subwindows too. I have to be the option to dysplay or hide each subwindow. D1 = Ratio - Ratio [-1] (diff between the current Ratio and the last ratio) D2 = D1 - D1 [-1] (diff between the current D1 and the last D1) Important: I only will order this indicator if later I can use it to create an EA to trade one or both of the Symbols. The calculations of the variable ratio should appear in the upper left of the chart. ------------------------------------------------------------------------------------------------------------------- Detailing exactly what I intend: I'm brazilian. We have Ibovespa Futures Index (Symbol = WIN$N) and the dollar price in Reais (Symbol = WDO$N). They are usually negatively correlated. I intend to capture any imbalance of this condition in the intraday. For instance, if both are positive it suggests that the dollar is Strong and that I should buy it. This MQL5 indicator is to study this and, if I find something useful, I will demand an EA to trade WDO$N or WIN$N. The equation, for this case, would be: Ratio = (Var % WIN$N + p*(Var % WDO$N)) * 100 .................... p is a real variable. So, what I want to see in the screen is just the dollar chart (WDO$N, Symbol 2) and the variable Ratio and the 2 differences thereof. What is wrong, and is to be fixed Var % Symbol 1 = (Current Close Price) / Previous Day Close - 1 This variable is to be calculated for each candle. The above variable is well calculated but there is a lag. In the current day of negotiation, D0, it is OK. In the prior day, D1, for the first Bar, B1, the variable returns zero, and for the second Bar, B2, the variable returns the value that should be for B1, for B3 the B2 real value, and so forth. In D2, B1 is wrong ,B2 = 0, and B3 was actually to be B1, B4 to be B2, and so forth. Summing up: D0 = OK D1 Real Indicator B1 0 B2 B1 B3 B2 ... ... D2 Real Indicator B1 WRONG B2 0 B3 B1 B4 B2 ... ... And so forth. The rest remains unchanged, regardless of the elimination of a boolean option I'll describe later.