The general technique for realtime strategies not when not specifying setComputeOnClose() is to in main:
If I am using a basic Stop and Reverse strategy that I wish to evaluate on every trade/tick would simply removing the test for getbarstate()==BARSTATE_NEWBAR allow my strategy to get executed for each trade?
If I'm getting control on each trade, would the calls to close(0), open(0), high(0), low(0) all return the same value, as for a given trade these values would be the same?
Can I specify setComputeOnClose() and still evalaute if a given price was traded intrabar?
The reason I ask is the more I get into converting a strategy object based strategy to realtime processing strategy the more I realize that for the most part IMHO, waiting for a NEWBAR may not be desirable. For example, if our stop price is hit, would anyone really what another 5, 15 or longer minutes to see where the bar closes prior to getting out. Most traders would probably not do that.
When I'm "discretionary" trading and I think this is generally true, for the most part, things like stops, profit targets, etc. most decisions about entry and exit are not delayed until a bar is completed but occur intrabar. This may or may not be the "wisest"
methodology but mimics more closely how most people trade.
I'm trying to modify my strategies to more accurately reflect this and it appears that the emphasis is geared toward the raising of this NEWBAR condition.
I would appreciate any suggestions, recomendations or comments from those who have perhaps been down this road.
Thanks
PHP Code:
if (gerbarstate()==BARSTATE_NEWBAR && getcurrentBarIndex ==0){
....then we are running realtime and perform tests for entry
}
If I'm getting control on each trade, would the calls to close(0), open(0), high(0), low(0) all return the same value, as for a given trade these values would be the same?
Can I specify setComputeOnClose() and still evalaute if a given price was traded intrabar?
The reason I ask is the more I get into converting a strategy object based strategy to realtime processing strategy the more I realize that for the most part IMHO, waiting for a NEWBAR may not be desirable. For example, if our stop price is hit, would anyone really what another 5, 15 or longer minutes to see where the bar closes prior to getting out. Most traders would probably not do that.
When I'm "discretionary" trading and I think this is generally true, for the most part, things like stops, profit targets, etc. most decisions about entry and exit are not delayed until a bar is completed but occur intrabar. This may or may not be the "wisest"
methodology but mimics more closely how most people trade.
I'm trying to modify my strategies to more accurately reflect this and it appears that the emphasis is geared toward the raising of this NEWBAR condition.
I would appreciate any suggestions, recomendations or comments from those who have perhaps been down this road.
Thanks
Comment