AddOrder function - schedule buy or close during current bar.

T

tplowe56

New member
I have strategy that uses ADX, MACD, and Double Smoothed Stochastics to pick entries long and short. The audible and printed "alert" are executed at the exact time of the occurrence (when all 3 parameters are met). TheAddOrder function on the other hand appears to default to executing at the next bar, and can be adjusted to High,Low,Close,Open, of the previous bar, if coded like this:

def orderprice = low[1]; Executes a buy at the low of the previous bar (the bar in which the signal was generated) This can lead to back testing which is not accurate.

Is it possible to code the AddOrder function to execute the order at exactly the same time & price as when the alert is issued? Sorry if this has been discussed but I could not find any reference to this.
 

Top