jtHMA Plot Wrong at Beginning of Series

Questions about MultiCharts and user contributed studies.
gdstuart
Posts: 5
Joined: 16 Mar 2015
Has thanked: 1 time

jtHMA Plot Wrong at Beginning of Series

Postby gdstuart » 05 Jun 2015

I DL'd the jtHMA function and study from:

viewtopic.php?f=5&t=4479&hilit=jthma

They both compile and run fine, but the beginning of the study plot always starts far below the price chart points so my strategies all start out with a wacky trade. Would some brave soul take a look at the code and see if you can determine why it does this? I am attaching a shot of jtHMA and a 14-day EMA on the same CL chart. Note the difference with the EMA; that's how I want jtHMA to behave also.

Thanks,

Geoff
Attachments
jtHMA vs EMA example.jpg
(442.41 KiB) Downloaded 404 times

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: jtHMA Plot Wrong at Beginning of Series

Postby TJ » 05 Jun 2015

I DL'd the jtHMA function and study from:
viewtopic.php?f=5&t=4479&hilit=jthma
They both compile and run fine, but the beginning of the study plot always starts far below the price chart points so my strategies all start out with a wacky trade. Would some brave soul take a look at the code and see if you can determine why it does this? I am attaching a shot of jtHMA and a 14-day EMA on the same CL chart. Note the difference with the EMA; that's how I want jtHMA to behave also.
Thanks,
Geoff
The jtHMA function needs more data on the chart to make a proper calculation.

gdstuart
Posts: 5
Joined: 16 Mar 2015
Has thanked: 1 time

Re: jtHMA Plot Wrong at Beginning of Series

Postby gdstuart » 05 Jun 2015

Is there some way I can alter the function to simply start plotting when it has sufficient data, like the EMA study does?

I backed the Data Range to mid-November 2014 so the HMA would be correctly calculated for 1/1/15 onwards. However, the strategy starts when the data starts so I still get a bad trade at the beginning. Short of hard-coding a start date into the strategy, is there some way to fix the function so it behaves like all the other ones? I'm not yet proficient enough in EasyLanguage to solve this myself.

Thanks,

Geoff

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: jtHMA Plot Wrong at Beginning of Series

Postby TJ » 05 Jun 2015

You can set the MaxBarsBack to avoid the dropout.


Return to “MultiCharts”