Based on the post that included the sample code, I understand:
- That the purpose of the "Trade" switch is to enable or disable the trade buttons.
- Although not necessary for this mouse driven trade event it was included to illustrate how to disable the function when a formula is loading or reloading.
- Trading will automatically become disabled and this technique should be included in any realtime formulas that are submitting trades.
What portions of an EFS during various barstates get reloaded and what variables get reset is something I don't fully understand, how does this technique accomplish this?
What is the reason for making this a "big G" (setGlobalVariable) variable?
Once the switch is set to enable via the setGlobalVariable wouldn't it remain set independent of any subsequent EFS loads and reloads?
Would this technique work if I was using this EFS loaded into multiple charts executing realtime trades given that the variable name is the same?
If not could I concatenate the symbol name to the globalvariable name setGlobalVariable("trade"+getsymbol(), vEnable) to use a unique name?
If formulas are triggering trades in realtime using EFS conditionals should the status of this flag be checked first to insure that trades are not executed on historical bars during a load or reload?
Right now I check for BARSTATE_NEWBAR and a Barindex of 0 to set a boolean realtime flag. For strategies run on Renko charts I also found that for some reason I also had to check for barindex of 0 prior to sending the order to eliminate redundant orders.
Should I add this additional check of the vEnable flag.
Thanks very much.
- That the purpose of the "Trade" switch is to enable or disable the trade buttons.
- Although not necessary for this mouse driven trade event it was included to illustrate how to disable the function when a formula is loading or reloading.
- Trading will automatically become disabled and this technique should be included in any realtime formulas that are submitting trades.
What portions of an EFS during various barstates get reloaded and what variables get reset is something I don't fully understand, how does this technique accomplish this?
What is the reason for making this a "big G" (setGlobalVariable) variable?
Once the switch is set to enable via the setGlobalVariable wouldn't it remain set independent of any subsequent EFS loads and reloads?
Would this technique work if I was using this EFS loaded into multiple charts executing realtime trades given that the variable name is the same?
If not could I concatenate the symbol name to the globalvariable name setGlobalVariable("trade"+getsymbol(), vEnable) to use a unique name?
If formulas are triggering trades in realtime using EFS conditionals should the status of this flag be checked first to insure that trades are not executed on historical bars during a load or reload?
Right now I check for BARSTATE_NEWBAR and a Barindex of 0 to set a boolean realtime flag. For strategies run on Renko charts I also found that for some reason I also had to check for barindex of 0 prior to sending the order to eliminate redundant orders.
Should I add this additional check of the vEnable flag.
Thanks very much.
Comment