Hello,
I am relatively new to scripting. I recently discovered it and wanted to create a basic custom script. I wanted a custom script to determine the Dollar Volume. The dollar volume would be the volume times the price. I wanted to take an average of the prices. I was able to create the script, but it’s asking for a positive integer. I thought that I found a related forum topic but it didn’t provide a suitable solution for this script: https://www.prorealcode.com/topic/screener-result-can-only-be-a-positive-integer/
Please let me know what I would need to modify in order to add this indicator to my chart. Your assistance would be greatly appreciated. Thank you so much!
hlc = DHigh (close) + DLow (close) + close
hlc1 = ABS(hlc)
hlc3 = hlc1 / 3
tdv = hlc3 * volume
RETURN tdv AS “Dollar Volume (avg $ * volume)”
I am not sure of how to modify a post. The rules indicate that I should Always use the ‘Insert PRT Code’ button when putting code in your posts. Please let me know if I have done that. If not, please advise as to where I should find the ‘Insert PRT Code’ button. Thank you again.
You didn’t (I will change it).
You can see from the attached pic what button we are talking about.
>> Please update your country flag in your profile. Thank you 🙂 <<
DHigh(0), DHigh(1), etc...
if you use CLOSE as an index:
- you may end up using a too high value (in case it’s DAX, SP, etc…)
- you will use a decimal value, which is not allowed (only integer); you should use ROUND() to make it integer
Awesome, it worked! I also appreciate the button attachment pic. I will update my flag.