Strategy MA issue

Moderator: admin

Strategy MA issue

Postby MrRiversideDude » Sun May 01, 2016 12:39 pm

Can you please review the attached indicator and tell me why I'm not capturing data for the 200 SMA?

Much thanks in advance!!
Attachments
Signals v15B TEST.lua
(16.46 KiB) Downloaded 774 times
MrRiversideDude
 
Posts: 87
Joined: Fri Feb 21, 2014 7:50 am

Re: Strategy MA issue

Postby Apprentice » Mon May 02, 2016 3:06 am

core.host:trace("++ Short 20 -------" .. short[j][i].DATA[short[j][i].DATA:size()-2]);
Will get you value of indicator one period ago.

Use short[j][i].DATA[short[j][i].DATA:size()-1] for current value.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Strategy MA issue

Postby MrRiversideDude » Mon May 02, 2016 10:18 pm

Thanks!
MrRiversideDude
 
Posts: 87
Joined: Fri Feb 21, 2014 7:50 am

Re: Strategy MA issue

Postby MrRiversideDude » Sun May 15, 2016 8:32 am

Thanks for the help, but I'm also trying to capture the value of the previous value but it's always zero for the 200 MA on the D1 timeframe. Any reason why?

I'm using code based on the MCP MTF MA Dashboard I downloaded from this site; see the slightly modified version. Seems like it should work.

Thanks!!!
Attachments
MCP MTF MA Dashboard V2.lua
(13.81 KiB) Downloaded 784 times
MrRiversideDude
 
Posts: 87
Joined: Fri Feb 21, 2014 7:50 am

Re: Strategy MA issue

Postby Apprentice » Tue May 17, 2016 5:02 am

I have not experienced this issue.
Did you load enough data.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia


Return to Indicator Development

Who is online

Users browsing this forum: No registered users and 11 guests