I'm using an EFS to do some backtesting. I buy at one moving average and sell at another.
the problem is that eMA is a precise number and not a price e.g. the eMA on the ES could be 1180.443 but you can't sell at that price. I want to sell at the nearest actual ES price which, in this case, would be 1180.5 or 1180.25.
Is there a function to convert a normal number into a price. I'm aware of formatPriceNumber but I think that formats a price as text for printing which isn't want I need. I need a valid price i.e 1180.25, 1180.50, 1180.75 etc.
On a side note, what happens if you pass an invalid price to strategy.doSell e.g. you pass 1180.443 instead of 1180.25?
Thank you.
the problem is that eMA is a precise number and not a price e.g. the eMA on the ES could be 1180.443 but you can't sell at that price. I want to sell at the nearest actual ES price which, in this case, would be 1180.5 or 1180.25.
Is there a function to convert a normal number into a price. I'm aware of formatPriceNumber but I think that formats a price as text for printing which isn't want I need. I need a valid price i.e 1180.25, 1180.50, 1180.75 etc.
On a side note, what happens if you pass an invalid price to strategy.doSell e.g. you pass 1180.443 instead of 1180.25?
Thank you.
Comment