Code examples

All posts which do not fit into any other sections of the forum.

Moderator: admin

Code examples

Postby ZoranB » Wed Jan 30, 2019 6:47 pm

Hi everyone,
new here and trying to find the best source for the code samples. I browsed through the User Guide but can't find much samples... For example, I am trying to alter one of the strategies to limit execution based on the ADX value but not sure what syntax I should use...

After crating the ADX object based on the candle close stream, I am using the following line of the code to read ADX value but I do not think it is obtaining the same value as ADX with the same parameter I see on my screen.
ADXValue = iADX.DATA:first();

any direction and help is appreciated....

Thanks,
Zoran
ZoranB
 
Posts: 6
Joined: Wed Jan 30, 2019 12:37 am

Re: Code examples

Postby Apprentice » Thu Jan 31, 2019 6:42 am

Hi from Zagreb
ADXValue = iADX.DATA:first();

Will return first period when iADX can be accessed.
Index on first ADX value calculated.
You will need to use iADX.DATA[period] or iADX.DATA[ iADX.DATA:size()-1] to access current or last ADX value respectively...
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 22093
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Code examples

Postby ZoranB » Thu Jan 31, 2019 9:47 am

Thanks a lot!
Any suggestion for a good syntax reference?
Regards from Toronto,
Zoran
ZoranB
 
Posts: 6
Joined: Wed Jan 30, 2019 12:37 am


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 4 guests