Position Priority based on Price and Volume
Author: shardis89
Creation Date: 11/20/2011 11:03 PM
profile picture

shardis89

#1
I am slowly trying to learn how to program, but spent several hours here now and couldnt get this one. I want to set a position priority based on price and volume, where any position with the highest price x volume would be assigned the highest priority. I am trying to implement this in the LDL2 strategy. Can someone please give this a stab.

CODE:
Please log in to see this code.
profile picture

Eugene

#2
QUOTE:
where any position with the highest price x volume would be assigned the highest priority

Probably something like this:
CODE:
Please log in to see this code.
profile picture

shardis89

#3
Thanks Eugene. Seems like that worked but had to change limit to limitPrice. Could you tell me how would set the priority for positions with the lowest price to sales ratio?
profile picture

Eugene

#4
Yep, it's limitPrice -- coded on-the-fly.

Re: price to sales - sure, see FundamentalDataSeries in the QuickRef > Fundamental Data. It's just another DataSeries, like Volume or Close. Specify the necessary fundamental item name in the itemName parameter (hint: see WLP fundamental User Guide PDF) and make sure that your fundamental data sources have been updated prior to running the resulting code.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).