CHECK THIS OUT: Real-time position checker, code included!
Posted: 07 Aug 2015
Hello,
I made a small utility which should help me to monitor strategies in real time. Please, I would appreciate any comments or recommendations.
How it's supposed to work:
1.) Add to your strategies following setting up of GVs:
GVSetNamedFloat(Getstrategyname+"_TT", Totaltrades);
GVSetNamedFloat(Getstrategyname+"_MP", Marketposition );
GVSetNamedFloat(Getstrategyname+"_BS", MarketPosition_at_Broker_for_The_Strategy );
GVSetNamedFloat(Getstrategyname+"_MP_B", MarketPosition_at_Broker);
GVSetNamedFloat(Getstrategyname+"_CC", CurrentContracts);
2.) Inputs to indicator are names of strategies which we would like to monitor on appropriate symbol. Indicator should pain bars based on position on chart, also it should alert user when following condition are not met:
I.) Internal check (Check Strategy Side) = no global variables needed
If TT = TT[1] and MP_BS <> MP[1]
then MisMatch = TRUE else MisMatch = FALSE;
II.) External check (Monitor number of contracts on symbol) = get numbers of contracts from each strategy and their summation should be equal to "MarketPosition_at_Broker" (MP_B).
Summ = CC1 + CC2 + CC3;
If Summ <> MP_B
then MisMatch = TRUE else MisMatch = FALSE;
Further notes:
* Using brokers data, so no further strategies should run on account for that symbol, also wont be working in back-test
* Can be easily coded for more strategies than 3 on symbol
* Working only for one symbol
* Not tested for scaling
* The most problematic part I think is a variable "flag" which I was pushed to use in order to minimize the number of warnings per bar due inside bars. As other chart will have a signals in different times, variables can change asynchronously with current chart, so that can cause problems and "falsely" trigger alert conditions. Any tip how to work it out and not to eliminate other ticks on bar appreciated!
* I tried the code only on range bars.
I appreciate any suggestion or potential problems notice (different conditions, potential threads, perhaps ideas when this condition do not work etc.).
Thank you,
John
I made a small utility which should help me to monitor strategies in real time. Please, I would appreciate any comments or recommendations.
How it's supposed to work:
1.) Add to your strategies following setting up of GVs:
GVSetNamedFloat(Getstrategyname+"_TT", Totaltrades);
GVSetNamedFloat(Getstrategyname+"_MP", Marketposition );
GVSetNamedFloat(Getstrategyname+"_BS", MarketPosition_at_Broker_for_The_Strategy );
GVSetNamedFloat(Getstrategyname+"_MP_B", MarketPosition_at_Broker);
GVSetNamedFloat(Getstrategyname+"_CC", CurrentContracts);
2.) Inputs to indicator are names of strategies which we would like to monitor on appropriate symbol. Indicator should pain bars based on position on chart, also it should alert user when following condition are not met:
I.) Internal check (Check Strategy Side) = no global variables needed
If TT = TT[1] and MP_BS <> MP[1]
then MisMatch = TRUE else MisMatch = FALSE;
II.) External check (Monitor number of contracts on symbol) = get numbers of contracts from each strategy and their summation should be equal to "MarketPosition_at_Broker" (MP_B).
Summ = CC1 + CC2 + CC3;
If Summ <> MP_B
then MisMatch = TRUE else MisMatch = FALSE;
Further notes:
* Using brokers data, so no further strategies should run on account for that symbol, also wont be working in back-test
* Can be easily coded for more strategies than 3 on symbol
* Working only for one symbol
* Not tested for scaling
* The most problematic part I think is a variable "flag" which I was pushed to use in order to minimize the number of warnings per bar due inside bars. As other chart will have a signals in different times, variables can change asynchronously with current chart, so that can cause problems and "falsely" trigger alert conditions. Any tip how to work it out and not to eliminate other ticks on bar appreciated!
* I tried the code only on range bars.
I appreciate any suggestion or potential problems notice (different conditions, potential threads, perhaps ideas when this condition do not work etc.).
Thank you,
John