Page 1 of 1

Indexing and Stream values

PostPosted: Tue Nov 05, 2019 11:41 am
by 3am.gjp
I am in the process of creating various types of indicators. Right now I am having difficulties understanding why some values are not evaluating as they should in Lua. Attatched is a simple code that has a loop looking for the lowest low over X periods.

This value is then assigned to a stream. Which I name intI[period]. Below I am trying to simply evaluate if the value in the stream is > or < certain values. The test that is saved is if the value == 5 then intIV[period] = intI[period].

My thought is that if the value in intI[period] is 5 than I should filter out all other stream values from intI[period]. When you run this script you will see it's not true though. It outputs values for 6 and 5. I can't wrap my head around why this is the case. There has to be something fundamental that I am missing about the language.

Please add some clarity for me.

Re: Indexing and Stream values

PostPosted: Wed Nov 13, 2019 3:51 pm
by Apprentice
If your goal is to find the minimum, you can use mathex.min.
min, minpos = mathex.min (source, period-10 +1, period)
This will find a minimum for last 10 candles.

Re: Indexing and Stream values

PostPosted: Wed Nov 13, 2019 3:57 pm
by Apprentice
My advice is to install the SDK.
http://fxcodebase.com/documentation.php
Contains Editor, Debugger, Extensive Help with examples.

If you'd be interested, I hold private sessions.
Prerequisite intermediate coding knowledge.

Re: Indexing and Stream values

PostPosted: Fri Jan 31, 2020 12:08 pm
by Strela_999
Thanks, I've installed it, and it does help a lot! I'm starting to brain out how all of that works, but I'm lacking experience and technical knowledge, and the SDK is a gold mine for that.