Psychology Index to see market sentiment

I would like to have the psychology index as an indicator in SQ4 beta9. It actually is very easy to implement, but the "custom indicators" function in beta8 is broken (or i´m not able to use it...). 



The index is counting bullish and bearish candles over a specified period on a given symbol and timeframe. For each bullish candle, it counts +1 and computes the index by the sum of updays diveded by the total period multiplied by 100 (for normalization). So the index is in the range of 0 to 100. 


Here is the code of the indicator:


#Param "LookBack",12 ' Number of lookback periods



If C > C[1] Then

UpDay=1
Else
UpDay=0
End If

PsychIndex = Sum(UpDay,LookBack) / LookBack * 100

SetScales(0,100)
Plot("Psychology Index",PsychIndex,blue)

Return PsychIndex

Attachments
  • Votes +2
  • Project SQ Programming
  • Type Feature
  • Status Fixed
  • Priority Normal

History

T
#1

TANGO

21.09.2018 14:20

Task created

MF
#2

Mark Fric

21.09.2018 14:20
it is not a problem to create an indicator like this, I'll make an article about it as an examole. However, I'm not sure we'll be able to make it into Beta 9
m
#3

mikeyc

21.09.2018 14:20
Would be great to see this as an example custom indicator in a tutorial.
m
#4

mikeyc

21.09.2018 14:20
Voted for this task.
n
#5

notch

21.09.2018 16:19
Voted for this task.
DR
#6

mentaledge

10.10.2018 22:14
Voted for this task.
TB
#7

Tomas Brynda

21.11.2018 16:16

Status changed from New to In progress

TB
#8

Tomas Brynda

22.11.2018 08:29

Status changed from In progress to Fixed

Attachment PsychologyIndex.zip added

PsychologyIndex.zip
(133.16 KiB)
Finished - you can find all needed files in the attachment including sample strategy
h
#9

hankeys

22.11.2018 17:26
where to put the java file? i cant see the new indicator in the building blocks
TB
#10

Tomas Brynda

23.11.2018 07:23

There are two options:

  1. Create a folder extend\Snippets\SQ\Blocks\Indicators\PsychologyIndex, place the java file inside 
  2. Create a folder SQ\Blocks\Indicators\PsychologyIndex in CodeEditor, add new file PsychologyIndex.java. Then copy the code from the java class provided and Save

Then it should appear amongst indicators in Building blocks after restarting SQ

h
#11

hankeys

23.11.2018 10:42
thanks, this works


will there be any database of these new building blocks, or you will be adding everything to the new builds?

TB
#12

Tomas Brynda

23.11.2018 11:00
All new extensions will be available either directly in SQ in upcoming builds or it will be listed on community webpage which is being prepared
h
#13

hankeys

23.11.2018 11:31
good job

Votes: +2

Drop files to upload

or

choose files

Max size: 5MB

Not allowed: exe, msi, application, reg, php, js, htaccess, htpasswd, gitignore

...
Wait please