Mixed Automated and Manual Trading

Questions about MultiCharts and user contributed studies.
User avatar
syswizard
Posts: 295
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 28 times

Mixed Automated and Manual Trading

Postby syswizard » 17 Nov 2020

I tried this a few months back:
SA (Sales Automation) was turned on for a chart and orders from my signal would be triggered.
However, when I attempted to enter a manual order, the signal would stop firing off orders if the manual order was executed.
In effect, the automated signal became disabled although it showed as active.

Has anyone experienced this ?
Any workaround ?
I can only think that by using Global Variables and another strategy to call the automated strategy is a potential solution albeit not that desirable.

biffhero
Posts: 47
Joined: 22 Sep 2020
Has thanked: 29 times
Been thanked: 7 times

Re: Mixed Automated and Manual Trading

Postby biffhero » 21 Nov 2020

When you create the manual order, and the signal stops firing, doe the "SA" icon stop being green, and return to grey?

I think I saw something like this myself, but I'm not sure. My internal narrative to understand it went like this.

"Oh, they are trying to err to the side of caution here, where if the universe changes at all out from underneath the SA, it stops and goes hands off."

I think the "broker synchronizer" signals might come in handy here.

Thanks,
Rob

McGeorge
Posts: 49
Joined: 22 Jun 2018
Has thanked: 10 times
Been thanked: 6 times

Re: Mixed Automated and Manual Trading

Postby McGeorge » 21 Nov 2020

I tried this a few months back:
SA (Sales Automation) was turned on for a chart and orders from my signal would be triggered.
However, when I attempted to enter a manual order, the signal would stop firing off orders if the manual order was executed.
In effect, the automated signal became disabled although it showed as active.

Has anyone experienced this ?
Any workaround ?
I can only think that by using Global Variables and another strategy to call the automated strategy is a potential solution albeit not that desirable.
You need to read Multicharts documentation about Auto Trading at https://www.multicharts.com/trading-sof ... to_Trading.

If the SA button (synchronous mode) stayed green after placing an order to broker manually, then the problem should not be with Multicharts application. You would then need to look into your coding logic. My feeling is your signal is triggered based on market position at strategy/broker/chart, which contradicts your logic. You may need to read carefully the definition of the keywords for market position:

Market Position Checking Keywords:
MarketPosition_at_Broker. Returns broker position.
MarketPosition_at_Broker_for_The_Strategy. Returns MC auto-trading engine position.
MarketPosition. Returns chart position (only direction).

User avatar
syswizard
Posts: 295
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 28 times

Re: Mixed Automated and Manual Trading

Postby syswizard » 21 Nov 2020

You need to read Multicharts documentation about Auto Trading at https://www.multicharts.com/trading-sof ... to_Trading.
I have read it and it does not address this issue specifically.
If the SA button (synchronous mode) stayed green after placing an order to broker manually, then the problem should not be with Multicharts application. You would then need to look into your coding logic. My feeling is your signal is triggered based on market position at strategy/broker/chart, which contradicts your logic. You may need to read carefully the definition of the keywords for market position:
My signal coding logic is simple: Buy("Thisbuy") 1 Contract This Bar At Close. Then I hit the Sell button on the Charting Panel, and the Long position is exited. The SA button stays green., but the signal never fires again. Any attempts to toggle the signal off and then on again are fruitless. Only when the workspace is closed and reopened does the signal fire again.
I am familiar with the synchronizer signals and they were not active. Perhaps I'll see if they make a difference.
From this: https://www.multicharts.com/trading-sof ... Instrument
What this seems to indicate is that for backtesting purposes, one can use MarketPosition. However, for LIVE TRADING, one must use Market_Position_At_Broker_For_The_Strategy or Market_Position_At_Broker in lieu of MarketPosition.
I am not sure which one is appropriate in this case.
Moreover, how does my signal know that we are trading live and not backtesting ?
Thanks for your feedback on this.

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: Mixed Automated and Manual Trading

Postby bowlesj3 » 21 Nov 2020

You need to read Multicharts documentation about Auto Trading at https://www.multicharts.com/trading-sof ... to_Trading.
Correct. I wanted to use some of the auto trading commands but not full automation. I hit a problem where something I did manually turned off auto trading mode. I found it in the wiki but Unfortunately I can't remember where it is because I stopped using the auto trading for other reasons (Canadian Regulators blocked it on all Canadian Exchanges and Interactive Brokers has not put in the required precautionary code to allow use of AT). I don't have any need to try and find it (far too busy too).

User avatar
syswizard
Posts: 295
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 28 times

Re: Mixed Automated and Manual Trading

Postby syswizard » 22 Nov 2020

Thanks for the response Bowles. At least I know now that someone else has encountered this problem.
I'll keep on experimenting with this.
I wish there was an Easy Language keyword like "IsLiveTrading" indicating there is an active data feed sending data when it is set to True.
That would be useful.

SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

Re: Mixed Automated and Manual Trading

Postby SUPER » 22 Nov 2020

I use following code in my strategies to check MarketPosition in Auto trading. (I have not tried Auto and Manual though).

if getappinfo(aistrategyauto) = 1 or GetAppInfo(aiStrategyAutoConf) = 1
then
MP = MarketPosition_at_Broker_for_The_Strategy
else
MP = MarketPosition;

User avatar
syswizard
Posts: 295
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 28 times

Re: Mixed Automated and Manual Trading

Postby syswizard » 22 Nov 2020

Thanks for that Super. Here are the details:
aiStrategyAuto - specifies return of a numerical value, indicating whether the calling application is using Automated Trade Execution GetAppInfo will return a value of 1 only if the calling application is using Automated Trade Execution, and a value of 0 in all other cases.
aiStrategyAutoConf - specifies return of a numerical value, indicating whether the calling application is using Automated Trade Execution with order confirmation turned off GetAppInfo will return a value of 0 only if the calling application is using Automated Trade Execution with order confirmation turned off, and a value of 1 in all other cases.

aiRealTimeCalc - specifies return of a numerical value, indicating whether the calling application’s calculations are based on real-time data GetAppInfo will return a value of 1 only if the calling application's calculations are based on real-time data, and a value of 0 in all other cases.

So the latter call parameter seems to indicate the real-time data feed is active. That is very useful.

However, the issue remains regarding mixed auto and manual trading on the same chart. For instance with a long position started auto, and then close manually, what is correct MP to use: MarketPosition_at_Broker_for_The_Strategy or MarketPosition_at_Broker ?
Since the strategy didn't close the order, it appears the latter would the one to use, no ?
On second thought, is it possible for MarketPosition_at_Broker_for_The_Strategy to still be > 1 after the manual order is placed ?
After all, from the strategy standpoint, it never issued the sell order to close the position.
This is kind of confusing.

SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

Re: Mixed Automated and Manual Trading

Postby SUPER » 23 Nov 2020

Thanks SysWizard for your detailed explanation and your idea of aiRealTimeCalc makes great sense.

I tried various market position options and found that MarkepPosition_Checked allowed the auto signal generation to continue despite manual orders being executed.

I started with a long position in auto mode and on next bar added (manually) additional long position and the auto system exited the trade on the third bar as per the signal leaving net 1 long position and it continued to do so for next signals generated without interfering with the manual trade. Position Match at times will remain false in Position tracker which is quite obvious.




.

User avatar
syswizard
Posts: 295
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 28 times

Re: Mixed Automated and Manual Trading

Postby syswizard » 23 Nov 2020

I tried various market position options and found that MarketPosition_Checked allowed the auto signal generation to continue despite manual orders being executed.
Well, thanks for that. The sparse documentation doesn't even the mention the difference between MarketPosition_Checked and MarketPosition.
In fact, the latest .CHM Help file doesn't even have it mentioned !


Return to “MultiCharts”