Download MetaTrader 5

Custom indicator giving different value in EA than in Data Window

To add comments, please log in or register


‌‌I am trying to get the values of a custom indicator to use in an EA.‌
My problem is that I cannot get the same values inside my EA as the values in the Data Window of the Indicator.

I‌n the attached picture you can see the values in the Data Window are different from the values that the EA is printing.

‌The code in the EA is below and is very simple. I used similar code in other EA's but never had this problem before.

C‌ould someone tell me what I am doing wrong?

I‌ attached the source of the Indicator I am using.



E‌dit: In the picture I put a rectangle on the wrong line in the Terminal. I marked the 3rd line while I am talking about the first line. The idea is the same.
The price in the Data Window does not match the price in the EA. 

#property copyright "Copyright 2017, FintechPro" #property link "" #property version "1.00" #property strict datetime CurrentTime; bool SignalSentCall; bool SignalSentPut; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- if(CurrentTime!=Time[0]) { SignalSentCall= false; SignalSentPut = false; CurrentTime=Time[0]; } double PriceBandUp = iCustom(NULL,0,"triangularma_centered_bands",0,1); double PriceBandDn = iCustom(NULL,0,"triangularma_centered_bands",1,1); if(!SignalSentCall) { SignalSentCall=true; PrintFormat("PriceBandUp: %f. PriceBandDn: %f",NormalizeDouble(PriceBandUp,4),NormalizeDouble(PriceBandDn,4)); } }

Carl Schreiber
Carl Schreiber  

The time stamps don't match!

To add comments, please log in or register