Indicator return value

How to create strategies and indicators
Message
Author
Eve
Posts: 19
Joined: Wed Mar 28, 2012 10:31 am

Indicator return value

#1 Postby Eve » Fri Apr 06, 2012 5:02 am

Hello!

I've programmed the indicator which i would like to use inside the strategy. The indicator is working fine but the problem is that at this point it's just graphical solution which means that it's just drawing some lines and not returning any values which i could use while prgramming the strategy.

How can I do that?
If I want to return the value which i could later grab with the GetIndicatorValue function what should i change inside the Calculate procedure?

Thanx a lot!

FT Support
Posts: 905
Joined: Sat Jul 11, 2009 10:54 am

#2 Postby FT Support » Sat Apr 07, 2012 2:33 pm

Hello,

Is it correct that you're just using graphical objects instead of buffers?

You can only get buffers values with GetIndicatorValue but not objects values.

There are 2 options how you can transfer indicator values to the strategy:

1) create invisible buffers (recommended)
2) export objects information into the files and then read these files with strategy.
Check our other product here:
http://www.forexcopier.com

Eve
Posts: 19
Joined: Wed Mar 28, 2012 10:31 am

#3 Postby Eve » Tue Apr 10, 2012 3:35 am

Thank you for the reply!

I have a problem using GetIndicatorValue function. I'm getting zero value all the time... Can you please explain the parameters of the function a bit more? I've read the help files but i'm still not sure that i'm using it correctly.
I have 3 visible buffers and one invisible buffer in the indicator which i listed in that order (inside the indicator). Is the Buffer Index automaticly selected or? Should the bufferIndex for the invisible buffer in this case be number 3?

And what about index inside the indicator's buffer? If u understood it correctly that's the index as the index of a bar??

Thank you in advance!

Eve
Posts: 19
Joined: Wed Mar 28, 2012 10:31 am

#4 Postby Eve » Tue Apr 10, 2012 10:37 am

Just to explain it into a little bit more details...

Inside the indicator i created index buffer which i would like to get from the strategy with:

TIndexBuffer izlaz;

inside the init procedure:
izlaz=CreateIndexBuffer();
SetIndexBuffer(10,izlaz);

and just so i can check if it's working inside the calculate procedure i put the line:

izlaz[0]=555;


inside the strategy i'm trying to get the value with the following code:

int indicatorMoje;
double VrijednostMoje;

inside the reset procedure:
sprintf(buff1,"%d;%d;%d;%d;Close;Yes;No;No;No;Yes;%d;Yes;Yes;0.001;No;No",9,4,6,7,18);
indicatorMoje=CreateIndicator(Currency, TimeFrame, "Moje", buff1);

inside the GetSingleTick procedure:
VrijednostMoje=GetIndicatorValue(indicatorMoje,0,10);
sprintf(pomocno,"%f", VrijednostMoje);
Print(pomocno);

In the end it's printing only zeros... What am I doing wrong?

FT Support
Posts: 905
Joined: Sat Jul 11, 2009 10:54 am

#5 Postby FT Support » Tue Apr 10, 2012 2:30 pm

Hello Eve,

Can you receive the values of other buffers?

did you get indicator handle in "indicatorMoje" variable or it is equal to 0 ?
Check our other product here:
http://www.forexcopier.com

Eve
Posts: 19
Joined: Wed Mar 28, 2012 10:31 am

#6 Postby Eve » Wed Apr 11, 2012 2:02 am

Hi,

Yes, I got indicator handle in "indicatorMoje"; tried to print it and everything was ok...

But I keep receiving zeros for all buffers...

Eve
Posts: 19
Joined: Wed Mar 28, 2012 10:31 am

#7 Postby Eve » Wed Apr 11, 2012 2:07 am

is it ok to use

izlaz[0]=555;

the way i described above to set the indicator to that value?

Eve
Posts: 19
Joined: Wed Mar 28, 2012 10:31 am

#8 Postby Eve » Wed Apr 11, 2012 2:18 am

I figured it out! :)

Thank you for the help! :)

edoughig
Posts: 7
Joined: Wed May 15, 2013 4:12 pm

#9 Postby edoughig » Fri May 17, 2013 3:25 pm

Eve wrote:I figured it out! :)

Thank you for the help! :)


What did you figure out as I am having the same issue. All I get are 0.0s from my custom indicator. Here's some code.

In ResetStrategy:
if(FGDIHandle == -1)
{
char fgdiInputs[1000];
sprintf(fgdiInputs, "%d;%d;%f;%f;", FGDIPeriod, FGDIPriceType, FGDIRandomLine, FGDIStdDevs);
FGDIHandle = CreateIndicator(Currency, Timeframe, "FGDI", fgdiInputs);
}

In GetSingleTick:
double fgdiLower = GetIndicatorValue(FGDIHandle, Shift, 2);
double test = GetIndicatorValue(FGDIHandle, Shift, 0);
double test1= GetIndicatorValue(FGDIHandle, 0, 2);
double test2 = GetIndicatorValue(FGDIHandle, 0, 0);

The indicator has 3 visible buffers and it prints fine in history mode attached to a chart. I am trying to get the last index/bar value of the third buffer (index 2). As a test I added the above calls to try to retrieve the 0-index value from buffer index 0 and 2, but no luck. I keep getting 0.0 on every bar...

Any ideas? And yes, FGDIHandle is valid and the journal shows that my indicator was created with the proper inputs.

EDIT: I should add that I can retrieve valid values from a built in indicator "ZigZag".

edoughig
Posts: 7
Joined: Wed May 15, 2013 4:12 pm

#10 Postby edoughig » Fri May 17, 2013 4:25 pm

edoughig wrote:
Eve wrote:I figured it out! :)

Thank you for the help! :)


What did you figure out as I am having the same issue. All I get are 0.0s from my custom indicator. Here's some code.

In ResetStrategy:
if(FGDIHandle == -1)
{
char fgdiInputs[1000];
sprintf(fgdiInputs, "%d;%d;%f;%f;", FGDIPeriod, FGDIPriceType, FGDIRandomLine, FGDIStdDevs);
FGDIHandle = CreateIndicator(Currency, Timeframe, "FGDI", fgdiInputs);
}

In GetSingleTick:
double fgdiLower = GetIndicatorValue(FGDIHandle, Shift, 2);
double test = GetIndicatorValue(FGDIHandle, Shift, 0);
double test1= GetIndicatorValue(FGDIHandle, 0, 2);
double test2 = GetIndicatorValue(FGDIHandle, 0, 0);

The indicator has 3 visible buffers and it prints fine in history mode attached to a chart. I am trying to get the last index/bar value of the third buffer (index 2). As a test I added the above calls to try to retrieve the 0-index value from buffer index 0 and 2, but no luck. I keep getting 0.0 on every bar...

Any ideas? And yes, FGDIHandle is valid and the journal shows that my indicator was created with the proper inputs.

EDIT: I should add that I can retrieve valid values from a built in indicator "ZigZag".


Ok, I figured out my problem. Wanted to let anyone else reading this know. My custom indicator used an Enum type input and I was passing in the int value from my strategy. You have to pass in the string label of the option value...

amberwine
Posts: 17
Joined: Fri Jul 12, 2013 3:47 am

#11 Postby amberwine » Sun Jul 14, 2013 1:56 pm

I also have a problem relating to the return value from GetIndicatorValue().

I've created a MACD indicator for a strategy I'm working on, with the following call in ResetStrategy:

Code: Select all

IndMACD = CreateIndicator(Currency, PERIOD_M15, "MACD", "5;13;3;Close");


In GetSingleTick() I call GetIndicatorValue() thus:

Code: Select all

if (!SetCurrencyAndTimeframe(Currency, PERIOD_M15))
   return;
...
MACDPrevious = GetIndicatorValue(IndMACD, 1, 2);


NOTE: SetCurrencyAndTimeframe is called for each invocation of GetSingleTick(), but GetIndicatorValue is only called once every simulated 15 minutes (with time-frame set to 15 mins).

If the 2nd parameter (index) = 1, I can match the values with the FT Data window for the appropriate date and time, but index=1 is documented as used to obtain the previous MACD value in the Strategies help-file. However, using the previous value means my buy/sell signals are coming a bit too late. I really want to get the current value, documented as requiring index = 0, as in:

Code: Select all

MACDCurrent = GetIndicatorValue(IndMACD, 0, 2);


However, this does not give a value that corresponds to the MACD value shown in the user interface Data window for the MACD indicator. I've tried printing the MACDCurrent value in the Journal, using Print(), but a different value is shown, compared to the value in the Data window for that date and time.

Is there any way to access the MACD value for the current tick, while in GetSingleTick(), as suggested by the GetIndicatorValue help-page in the Strategies API help-file?

Phil_Trade
Posts: 94
Joined: Tue Jan 31, 2012 5:14 am
Contact:

#12 Postby Phil_Trade » Sun Jul 14, 2013 2:52 pm

amberwine wrote:I also have a problem relating to the return value from GetIndicatorValue().

I've created a MACD indicator for a strategy I'm working on, with the following call in ResetStrategy:

Code: Select all

IndMACD = CreateIndicator(Currency, PERIOD_M15, "MACD", "5;13;3;Close");


In GetSingleTick() I call GetIndicatorValue() thus:

Code: Select all

if (!SetCurrencyAndTimeframe(Currency, PERIOD_M15))
   return;
...
MACDPrevious = GetIndicatorValue(IndMACD, 1, 2);


NOTE: SetCurrencyAndTimeframe is called for each invocation of GetSingleTick(), but GetIndicatorValue is only called once every simulated 15 minutes (with time-frame set to 15 mins).

If the 2nd parameter (index) = 1, I can match the values with the FT Data window for the appropriate date and time, but index=1 is documented as used to obtain the previous MACD value in the Strategies help-file. However, using the previous value means my buy/sell signals are coming a bit too late. I really want to get the current value, documented as requiring index = 0, as in:

Code: Select all

MACDCurrent = GetIndicatorValue(IndMACD, 0, 2);


However, this does not give a value that corresponds to the MACD value shown in the user interface Data window for the MACD indicator. I've tried printing the MACDCurrent value in the Journal, using Print(), but a different value is shown, compared to the value in the Data window for that date and time.

Is there any way to access the MACD value for the current tick, while in GetSingleTick(), as suggested by the GetIndicatorValue help-page in the Strategies API help-file?


Hi

with MACD D1, I have no problem to read index 0 and it's same value as in window indicator . I suspect your code about what you write ->
but GetIndicatorValue is only called once every simulated 15 minutes

Could you publish more than I can analyse it ?
my live account - 8 based pairs with optimized parameters : +188%
http://www.myfxbook.com/members/Philipp ... jpg/519044
TradeSlide : http://bit.ly/14R9Nf6

to be informed about Windev/MT4 services : a04486-tradingsignal@yahoo.fr

amberwine
Posts: 17
Joined: Fri Jul 12, 2013 3:47 am

#13 Postby amberwine » Sun Jul 14, 2013 3:13 pm

Here is more of my code, as requested:

Code: Select all

EXPORT void __stdcall  ResetStrategy()
{
   OrderHandle = -1;
   
   //ignoreTicks = MIN_TICKS;
   //ignoreTicks = 8;
   ignoreIntervals = 30;

   lastProfit = 0;
   nextExpectedIntervalTime = 0;
   MACDCurrent = 0;
   MACDSignal = 0;
   MACDPrevious = 0;
   MACDPreviousSignal = 0;
   MACDMin = 0;
   MACDMax = 0;
   
   IndMACD = CreateIndicator(Currency, PERIOD_M15, "MACD", "5;13;3;Close");
}

EXPORT void __stdcall GetSingleTick()
{
   if (strcmp(Symbol(), Currency) != 0)
      return;

   if (!SetCurrencyAndTimeframe(Currency, PERIOD_M15))
      return;

   TDateTime time = TimeCurrent();
   //if (!IsFifteenMinuteTick(time))
   //   return;

   //sprintf(buffer, "Date: {0}/{1}/{2}", );
   //OutputDebugStringA("Test output debug string\n");

   // this happens the first time we run through, to set the nextExpectedIntervalTime
   if (nextExpectedIntervalTime == 0)
   {
      // calculate the expected time of the next 15-minute interval
      nextExpectedIntervalTime = NextIntervalTime(time);
   }

   if (time < nextExpectedIntervalTime)
      return;

   // if we get here, then time >= nextExpectedTimeInterval, so we have the next interval to be processed
   // first, calculate the expected time of the next 15-minute interval
   nextExpectedIntervalTime = NextIntervalTime(time);

   // get the current MACD values
   MACDPrevious = MACDCurrent;
   MACDCurrent = GetIndicatorValue(IndMACD, 1, 2);
   //MACDPreviousSignal = MACDSignal;
   MACDSignal = GetIndicatorValue(IndMACD, 1, 3);
   //MACDPrevious = GetIndicatorValue(IndMACD, 1, 2);

   // make sure it is valid before continuing
   if (MACDCurrent == 0 || MACDPrevious == 0)
      return;

   // ignore the required number of intervals, before the indicator stabilizes
   if (ignoreIntervals > 0 && --ignoreIntervals > 0)
      return;

   sprintf(buffer, "%.8f, %.8f, %.8f", time, MACDCurrent, MACDSignal);
   //sprintf(buffer, "%.8f, %.8f, %.8f", time, MACDPrevious, MACDPreviousSignal);
   Print(buffer);

... additional code follows ...



NOTE: I have set the time-frame to 15-minutes in the FT UI. What I'm trying to do is process values every (simulated) 15 minutes, instead of every tick. The call to NextIntervalTime(time) returns a time value equivalent to the current time value rounded up to the next 15-minute event, so 2001-01-03 08:02 becomes 2001-01-03 08:15, for example. I store this new time value for comparison with future tick-times and return early, aborting processing for ticks prior to the next 15-minute event. I'm doing this because I want to identify crossing points (and therefore buy/sell signals) for the MACD 15-minute histogram, not at the tick-level. I hope this makes sense?

I've only been using the product for less than 1 week, so there may be better ways to achieve what I want. Any suggestions gratefully accepted!

Thanks for your help.

Phil_Trade
Posts: 94
Joined: Tue Jan 31, 2012 5:14 am
Contact:

#14 Postby Phil_Trade » Sun Jul 14, 2013 3:39 pm

I'm doing this because I want to identify crossing points (and therefore buy/sell signals) for the MACD 15-minute histogram, not at the tick-level. I hope this makes sense?


:) not a lot ! Please clarify with an example !

crossing points -> of what ? main and signal ?
my live account - 8 based pairs with optimized parameters : +188%

http://www.myfxbook.com/members/Philipp ... jpg/519044

TradeSlide : http://bit.ly/14R9Nf6



to be informed about Windev/MT4 services : a04486-tradingsignal@yahoo.fr

amberwine
Posts: 17
Joined: Fri Jul 12, 2013 3:47 am

#15 Postby amberwine » Mon Jul 15, 2013 12:01 am

I'm currently using it by looking for the MACD value crossing the origin. So, what I mean by a crossing-point is when the MACD value changes sign, from negative to positive or from positive to negative. There are other ways to use this indicator, e.g. using the signal line, but I'm not currently using that.

However, the way I'm using it is not really the issue. I cannot code any kind of strategy unless I can read the input data required. Since you asked about this, I'm guessing that you can't see any obvious reason from the code why I shouldn't be reading the index=0 (i.e. the most recent) value of MACD. Would that be the case?

As you mentioned that you have no problem reading the index=0 value, maybe you could post some code showing how you do it? It would help me as a starting-point.

Phil_Trade
Posts: 94
Joined: Tue Jan 31, 2012 5:14 am
Contact:

#16 Postby Phil_Trade » Mon Jul 15, 2013 1:17 am

amberwine wrote:I'm currently using it by looking for the MACD value crossing the origin. So, what I mean by a crossing-point is when the MACD value changes sign, from negative to positive or from positive to negative. There are other ways to use this indicator, e.g. using the signal line, but I'm not currently using that.

However, the way I'm using it is not really the issue. I cannot code any kind of strategy unless I can read the input data required. Since you asked about this, I'm guessing that you can't see any obvious reason from the code why I shouldn't be reading the index=0 (i.e. the most recent) value of MACD. Would that be the case?

As you mentioned that you have no problem reading the index=0 value, maybe you could post some code showing how you do it? It would help me as a starting-point.


I can't debug your code as I'm using Delphi not C. But you can do this :

Test a simple strategy with in GetSingleTick() only

MACDCurrent = GetIndicatorValue(IndMACD, 0, 2);
MACDPrevious = GetIndicatorValue(IndMACD, 1, 2);
Print...

to see if there is a problem with MACD or as I suggest with your code simulating M15.

and let me know
my live account - 8 based pairs with optimized parameters : +188%

http://www.myfxbook.com/members/Philipp ... jpg/519044

TradeSlide : http://bit.ly/14R9Nf6



to be informed about Windev/MT4 services : a04486-tradingsignal@yahoo.fr

Phil_Trade
Posts: 94
Joined: Tue Jan 31, 2012 5:14 am
Contact:

#17 Postby Phil_Trade » Mon Jul 15, 2013 2:49 am

Phil_Trade wrote:
amberwine wrote:I'm currently using it by looking for the MACD value crossing the origin. So, what I mean by a crossing-point is when the MACD value changes sign, from negative to positive or from positive to negative. There are other ways to use this indicator, e.g. using the signal line, but I'm not currently using that.

However, the way I'm using it is not really the issue. I cannot code any kind of strategy unless I can read the input data required. Since you asked about this, I'm guessing that you can't see any obvious reason from the code why I shouldn't be reading the index=0 (i.e. the most recent) value of MACD. Would that be the case?

As you mentioned that you have no problem reading the index=0 value, maybe you could post some code showing how you do it? It would help me as a starting-point.


I can't debug your code as I'm using Delphi not C. But you can do this :

Test a simple strategy with in GetSingleTick() only

MACDCurrent = GetIndicatorValue(IndMACD, 0, 2);
MACDPrevious = GetIndicatorValue(IndMACD, 1, 2);
Print...

to see if there is a problem with MACD or as I suggest with your code simulating M15.

and let me know


I should add that to test MACD Main 0 cross, you just need to test for a BUY

1 - if you want the CURRENT MACD bar cross 0

Code: Select all

if GetIndicatorValue(IndMACD, 0, 2) > 0 and GetIndicatorValue(IndMACD, 1, 2) <0


2 - if you want the LAST COMPLETE MACD bar cross 0

Code: Select all

if GetIndicatorValue(IndMACD, 1, 2) > 0 and GetIndicatorValue(IndMACD, 2, 2) <0
my live account - 8 based pairs with optimized parameters : +188%

http://www.myfxbook.com/members/Philipp ... jpg/519044

TradeSlide : http://bit.ly/14R9Nf6



to be informed about Windev/MT4 services : a04486-tradingsignal@yahoo.fr

amberwine
Posts: 17
Joined: Fri Jul 12, 2013 3:47 am

#18 Postby amberwine » Mon Jul 15, 2013 4:42 am

I will do as you suggest and report back.

However, could I just ask... when you read the 'previous' value of an indicator such as MACD, as in

Code: Select all

MACDCurrent = GetIndicatorValue(IndMACD, 0, 2);
MACDPrevious = GetIndicatorValue(IndMACD, 1, 2);


Is that reading the MACD value from the previous tick? What if I want the previous M15 value. What is the standard way of obtaining that?

I thought that perhaps this was the purpose of calling

Code: Select all

SetCurrencyAndTimeframe(Currency, PERIOD_M15)


in GetSingleTick(), but it's unclear to me exactly what that call to SetCurrencyAndTimeframe is doing. From the description of this function in the Strategies API help file, it seems that Bid(), Ask(), will use default values set by this call. Does this mean that if you call SetCurrencyAndTimeframe with PERIOD_M15, that Bid() and Ask() will give you prices adjusted to the nearest 15 minutes?

If so, does that also apply to indicators? So if I call SetCurrencyAndTimeframe with PERIOD_M15, and then call GetIndicatorValue for MACDPrevous, can I expect to get the value for the previous 15-minute event, or for the previous tick? if the former, then I don't need to bother with my custom 15-minute adjustment code.

Could you clarify this for me, please?

Phil_Trade
Posts: 94
Joined: Tue Jan 31, 2012 5:14 am
Contact:

#19 Postby Phil_Trade » Mon Jul 15, 2013 5:06 am

amberwine wrote:I will do as you suggest and report back.

However, could I just ask... when you read the 'previous' value of an indicator such as MACD, as in

Code: Select all

MACDCurrent = GetIndicatorValue(IndMACD, 0, 2);
MACDPrevious = GetIndicatorValue(IndMACD, 1, 2);


Is that reading the MACD value from the previous tick? What if I want the previous M15 value. What is the standard way of obtaining that?

I thought that perhaps this was the purpose of calling

Code: Select all

SetCurrencyAndTimeframe(Currency, PERIOD_M15)


in GetSingleTick(), but it's unclear to me exactly what that call to SetCurrencyAndTimeframe is doing. From the description of this function in the Strategies API help file, it seems that Bid(), Ask(), will use default values set by this call. Does this mean that if you call SetCurrencyAndTimeframe with PERIOD_M15, that Bid() and Ask() will give you prices adjusted to the nearest 15 minutes?

If so, does that also apply to indicators? So if I call SetCurrencyAndTimeframe with PERIOD_M15, and then call GetIndicatorValue for MACDPrevous, can I expect to get the value for the previous 15-minute event, or for the previous tick? if the former, then I don't need to bother with my custom 15-minute adjustment code.

Could you clarify this for me, please?


1 - When you call MACDPrevious = GetIndicatorValue(IndMACD, 1, 2) you have the MACD of the last complete M15 bar
but you're right, when you call MACDCurrent = GetIndicatorValue(IndMACD, 0, 2) you receive the actual M15 MACD which could change every tick (with BID)

2 -SetCurrencyAndTimeframe is doing -> only set some variable like Ask,Bid... nothing to do with GetIndicatorValue()

3 - can I expect to get the value for the previous 15-minute event : If you want the MACD value of the last 15 past minutes, I think it's impossible. You could only have the MACD of last M15 candle, or current M15 candle, and this last one, change every tick.

Hope it's clear for you :)
my live account - 8 based pairs with optimized parameters : +188%

http://www.myfxbook.com/members/Philipp ... jpg/519044

TradeSlide : http://bit.ly/14R9Nf6



to be informed about Windev/MT4 services : a04486-tradingsignal@yahoo.fr

amberwine
Posts: 17
Joined: Fri Jul 12, 2013 3:47 am

#20 Postby amberwine » Tue Jul 16, 2013 3:46 am

1 - When you call MACDPrevious = GetIndicatorValue(IndMACD, 1, 2) you have the MACD of the last complete M15 bar
but you're right, when you call MACDCurrent = GetIndicatorValue(IndMACD, 0, 2) you receive the actual M15 MACD which could change every tick (with BID)


I agree, this is what I get in Pascal and C++.

2 -SetCurrencyAndTimeframe is doing -> only set some variable like Ask,Bid... nothing to do with GetIndicatorValue()


Yes, this doesn't seem to have any effect on the value of current or previous MACD returned.

3 - can I expect to get the value for the previous 15-minute event : If you want the MACD value of the last 15 past minutes, I think it's impossible. You could only have the MACD of last M15 candle, or current M15 candle, and this last one, change every tick.


I don't agree. The value of the MACD between 0 and 15 minutes ago can be obtained from:

Code: Select all

MACDPrevious = GetIndicatorValue(IndMACD, 1, 2);


although this is only the value 15 minutes ago at the very end of a 15-minute period.

Alternatively,

Code: Select all

MACDPrevious = GetIndicatorValue(IndMACD, 2, 2);


gives the MACD value between 15 and 30 minutes ago, so would give the value 15 minutes ago when taken at the start of a new 15-minute period. Perhaps you mean that it's not possible to get the value exactly 15-minutes prior to the current tick-time. Fair enough. But, I suppose you could get close to that by storing 15-minutes worth of current MACD values in an internal buffer. I don't think I want to do that, though.

What seems to happen is that, if the time-frame is set to 15 minutes, then on the last tick of a 15-minute period, say 2001.01.03 11:29:45, the current MACD value may be 0.00108443, say. Then, on the next tick, at the start of a new 15-minute period, this MACD value becomes the new previous-MACD value (index=1) and the old previous value becomes the new index=2 (previous previous) value, with a new current MACD value for the new tick.

As you say, the current value changes on every tick, but the index=1 and index=2 values only change once every 15 minutes, at the start of a new 15-minute period.

However, for some reason, the MACD value given in the Data window doesn't correspond to any actual MACD value for the time shown in the Data window. Instead, the MACD value shown is the current value of the MACD for the tick at the very end of the M15 period beginning with the time shown in the Data window, according to my journal records. So, for EURUSD M15 on 2001.01.04 11:00 I get a value in the Data window for the MACD (5, 13, 3, Close) = 0.00127, but the journal reports this value for the time shown in the Data window - from Print(string value of MACDCurrent) - as = 0.00132354. However, scrolling forward in the journal to the final tick in that M15 period, which occurs at 11:14:30 reveals a current MACD value = 0.00126640, which when rounded up to 6 decimal places corresponds to the value given for 11:00 in the Data window. This seems a bit strange and I wonder if it's by design, or a bug?

This accounts for why I could not match up the values in the journal with the values in the Data window. Wouldn't it make more sense to show the current MACD value for the start of the period in the Data window, rather than the current MACD value for the end of that period? Although, I suppose using the current value from the last tick in a period means that that value will become the previous MACD value for the next period, which makes sense in a slightly convoluted way (previous MACD value from next period = 'current' MACD value from current period, in a sense).


Return to “FT API”

Who is online

Users browsing this forum: No registered users and 17 guests