My current system bases trades on bar close and uses
"setComputeOnClose(true);"
in function preMain with
"if(getCurrentBarIndex() == -1) {"
before my order logic. I would like to change my system, however, so that the first trade is triggered based on a bar high or low with subsequent trades to be based on bar close.
Would the way to achieve this be to use
"if(getBarState() == BARSTATE_CURRENTBAR) {"
before my order logic for my first trade and
"if(getBarState() == BARSTATE_NEWBAR) {"
before my order logic for my subsequent trades?
Would I have to make any changes other than eliminating "setComputeOnClose(true);", "if(getCurrentBarIndex() == -1) {", and providing end brackets?
Thanks.
Mark
"setComputeOnClose(true);"
in function preMain with
"if(getCurrentBarIndex() == -1) {"
before my order logic. I would like to change my system, however, so that the first trade is triggered based on a bar high or low with subsequent trades to be based on bar close.
Would the way to achieve this be to use
"if(getBarState() == BARSTATE_CURRENTBAR) {"
before my order logic for my first trade and
"if(getBarState() == BARSTATE_NEWBAR) {"
before my order logic for my subsequent trades?
Would I have to make any changes other than eliminating "setComputeOnClose(true);", "if(getCurrentBarIndex() == -1) {", and providing end brackets?
Thanks.
Mark
Comment