Jump to content
Medved Trader Forums

Looping functions in paintbars/scans


Recommended Posts

If you missed it, I'd like to point to our convenient looping functions in Advanced code:

https://www.medvedtrader.com/trader/WebHelp/index.html?advanced_looping_functions.htm

From our support emails, it seems that paintbar users may not be aware of them.

For example, if you have a variable SMA20 which is an SMA and you want to do something if it has been rising for the last 4 candles, all you have to do is call:

All(4, SMA20 > SMA20[1])   // will return true for that condition. Don't have to use a for loop etc.

or you want to check if the Close was above SMA20 in at least 5 out of 6 last candles...

Count(6, Close>SMA20) >= 5

nice and simple.

 

 

 

 

 

 

  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...