How do you get an order submitted, accepted and executed on the same date?
Simply: you are logging things at the same point in time, but not logging the time at which they happened. This is what @ab_trader suggested as the most obvious explanation for the apparent mismatch in prices and execution.The mismatch happens because you compare the order price with the wrong prices.
Okay. I have changed a few things around, and I think I see what's going on here, and where I need to make changes.
Actually what you are probably looking for is the parameter sessionend to the data feeds. The default value is None. If you specifically set it with a datetime.time(hh, mm, ss) instance, that will be used as the time also for daily bars.
mydata = DataFeedCls(dataname='xxx', sessionend=datetime.time(hh, mm, ss))
#myindex --method 1-- this does not work
self.myindex = ForexIndex()
#myindex --Method 2--crude-- i get a value but when i try to use it or retrieve and use it in other calculation i can't get it
self.myindex = ( (14.197569 * pow(self.data0.close, -0.668) * pow(self.data1.close, -0.202) * pow(self.data2.close, 0.130))
On a second quick look.
Your class has no __init__ and in case it had one you overwrite self.mindex with a calculation.
It would be good if you showed how you have used _mindatas (with an s at the end) and the definition of the data feeds. A one line complaining about not having been possible cannot be looked into.
No, under buy_price, because your are talking about stop-loss (you are in the market), people will understand the price at which you bought your asset and not the expected (and yet unknown) price at which the next order, the stop-loss one will execute.
Got this. I've declared a new variable which is store buy_price and updates it in notify order method with order.executed.price.
No. If no specific line is passed, the 1st defined line is used. In the case of regular data feeds, close is defined as the 1st line to match the de-facto standard which is to do things directly on the close price.