Indexing and Stream values

Section for discussions related to indicators, use of indicators, and building of trading stategies using indicators.

Moderator: admin

Indexing and Stream values

Postby 3am.gjp » Tue Nov 05, 2019 11:41 am

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.
3am.gjp
 
Posts: 4
Joined: Tue Jun 26, 2018 11:31 am

Re: Indexing and Stream values

Postby Apprentice » Wed Nov 13, 2019 3:51 pm

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.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 23887
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Indexing and Stream values

Postby Apprentice » Wed Nov 13, 2019 3:57 pm

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.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 23887
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Indexing and Stream values

Postby Strela_999 » Fri Jan 31, 2020 12:08 pm

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.
Strela_999
 
Posts: 6
Joined: Thu Jan 30, 2020 12:29 pm


Return to Discussions

Who is online

Users browsing this forum: No registered users and 1 guest