Might be a long shot but here goes. I am writing a program (for my own use only) that will send a warning email whenever Multicharts automation is disabled.
Is there any way of programmatically detecting whether automation is enabled\disabled, such as a registry value, file or TCP port change?
How to detect whether autotrading is enabled?
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007
Hi Brendan,
Registry value, file or TCP port can only be used by a file.
What you can do is insert the following line into your Study:
You can also use a more sophisticated approach. Your strategy will plot Text, an indicator will recognize the drawing, find out what state AT is in and sends an e-mail alert.
Advantage: the solution only involves MC.
Limitation: it will react one bar too late. If you lose connection to the provider, the strategy will not be calculated and the alert will not be sent.
1. Strategy:
2 – Indicator
3 – apply both the strategy and the indicator to the chart
4 – enable Email Alert for the indicator.
P.S. The code is very basic and needs to be fine-tuned.
Registry value, file or TCP port can only be used by a file.
What you can do is insert the following line into your Study:
Code: Select all
//-------------
Getappinfo(aiStrategyAuto). It will return 1 if AT is on and 0 if it is off.
//-------------
You can also use a more sophisticated approach. Your strategy will plot Text, an indicator will recognize the drawing, find out what state AT is in and sends an e-mail alert.
Advantage: the solution only involves MC.
Limitation: it will react one bar too late. If you lose connection to the provider, the strategy will not be calculated and the alert will not be sent.
1. Strategy:
Code: Select all
//--------------------------------------------
var: text_id(0);
if text_id <> 0 then Text_Delete(text_id);
text_id=text_new_s(Date,Time_s,High,"AT="+IffString( getappinfo(aiStrategyAuto)=1," On"," Off"));
//---------------------------------------------
Code: Select all
//---------------------------------------------
alert(text_getstring(1));
//---------------------------------------------
4 – enable Email Alert for the indicator.
P.S. The code is very basic and needs to be fine-tuned.
Thanks Marina,
A good solution, I'm not concerned about losing connection to my data provider because my data provider is TS which I've set up to email me if data stops. The only problem is (as you say) this alert could lag by the length of a bar, and a lot can happen in the space of a bar!
I've done some more work on this and according to my testing, a connection on TCP port 7496 is established when MC-IB autotrading is enabled. So I can monitor that and send an email within a few seconds of disconnection.
PS, a small request, please can you add shortcut keys for the Close Position, and Do Not Close Position buttons in the Auto Trading Warning window that is displayed when you disable autotrading while in a position. Many autotraders automate the interface using macros and scripts, and shortcut keys for buttons and menu options (denoted by an underscored character) make these much more robust, so they are very important. I'm sure those who have difficulty using a mouse will appreciate the easier accessibility too.
Many thanks again.
A good solution, I'm not concerned about losing connection to my data provider because my data provider is TS which I've set up to email me if data stops. The only problem is (as you say) this alert could lag by the length of a bar, and a lot can happen in the space of a bar!
I've done some more work on this and according to my testing, a connection on TCP port 7496 is established when MC-IB autotrading is enabled. So I can monitor that and send an email within a few seconds of disconnection.
PS, a small request, please can you add shortcut keys for the Close Position, and Do Not Close Position buttons in the Auto Trading Warning window that is displayed when you disable autotrading while in a position. Many autotraders automate the interface using macros and scripts, and shortcut keys for buttons and menu options (denoted by an underscored character) make these much more robust, so they are very important. I'm sure those who have difficulty using a mouse will appreciate the easier accessibility too.
Many thanks again.
-
- Posts: 103
- Joined: 05 Sep 2007
- Has thanked: 8 times
- Been thanked: 6 times
Hi,
I looking for a solution for check MC and autotrading in Real time along the day.
The idea is to check GetAppInfo() and the positions, check position signal side and broker side etc.
The solution describe below is not good enough because the information is update only at the end of the bar. and with 240 mn bar...
Is it possible to update GetappInfo() at begin of bar for have info at the begin of day for example?
I try differents solutions for obtain information more frequently that end of bar.
// IOG solution ?
IOG = true and send order only if barstatus = 0 : i dont have the same orders in the chart in the previous days.
IOG = true and send order only if barstatus = 1 : i dont have the same orders in the chart in the previous days.
// Chart 1 mn
I put a chart in 1 mn and kept the original chart.
The idea is to calculate signal on the original chart and update info to personal log file in the 1 mn chart.
Unfortunatly, it doesn't work, the signal is not run each mn on the 1 mn chart.
So do you have any idea ?
Thanks
Samuel
I looking for a solution for check MC and autotrading in Real time along the day.
The idea is to check GetAppInfo() and the positions, check position signal side and broker side etc.
The solution describe below is not good enough because the information is update only at the end of the bar. and with 240 mn bar...
Is it possible to update GetappInfo() at begin of bar for have info at the begin of day for example?
I try differents solutions for obtain information more frequently that end of bar.
// IOG solution ?
IOG = true and send order only if barstatus = 0 : i dont have the same orders in the chart in the previous days.
IOG = true and send order only if barstatus = 1 : i dont have the same orders in the chart in the previous days.
// Chart 1 mn
I put a chart in 1 mn and kept the original chart.
The idea is to calculate signal on the original chart and update info to personal log file in the 1 mn chart.
Unfortunatly, it doesn't work, the signal is not run each mn on the 1 mn chart.
So do you have any idea ?
Thanks
Samuel
-
- Posts: 103
- Joined: 05 Sep 2007
- Has thanked: 8 times
- Been thanked: 6 times
Hi
IOG = Intrabar Order
I wrote i my post :
// IOG solution ?
IOG = true and send order only if barstatus = 0 : i dont have the same orders in the chart in the previous days.
IOG = true and send order only if barstatus = 1 : i dont have the same orders in the chart in the previous days.
So it doesn't work, because i don't have the same order. I want order are send only at end of bar. and even if i use barstatus = 0 or 1 then i don't have the same orders than if i don't use IOG
IOG = Intrabar Order
I wrote i my post :
// IOG solution ?
IOG = true and send order only if barstatus = 0 : i dont have the same orders in the chart in the previous days.
IOG = true and send order only if barstatus = 1 : i dont have the same orders in the chart in the previous days.
So it doesn't work, because i don't have the same order. I want order are send only at end of bar. and even if i use barstatus = 0 or 1 then i don't have the same orders than if i don't use IOG
Hi,
with the chart, you can have intrabar update, so why not using GetAppInfo on each tic instead of each bar ?
Like that , the length of the bar doesn't mater
Hi rondot
I think I see your point, and I have the solution :
You want to use the intra bar to use GetAppInfo
but you want to send the order only if a new bar appear . Here is the solution I use :
1/ you turn on the intrabar
2/ add in your strategy :
Variable: IntrabarPersist LastDateTime("");
if LastDateTime<>numtostr(TIME,0) then begin
HERE YOU PUT YOUR ORDER
end
else begin
HERE YOU USE GetAppInfo
END;
LastDateTime=numtostr(TIME,0);
Like that only GetAppInfo will be called during the intrabar
I hope this will help you
I think I see your point, and I have the solution :
You want to use the intra bar to use GetAppInfo
but you want to send the order only if a new bar appear . Here is the solution I use :
1/ you turn on the intrabar
2/ add in your strategy :
Variable: IntrabarPersist LastDateTime("");
if LastDateTime<>numtostr(TIME,0) then begin
HERE YOU PUT YOUR ORDER
end
else begin
HERE YOU USE GetAppInfo
END;
LastDateTime=numtostr(TIME,0);
Like that only GetAppInfo will be called during the intrabar
I hope this will help you
-
- Posts: 261
- Joined: 28 Feb 2008
- Has thanked: 2 times
- Been thanked: 1 time
Hi,
From time to time I may loose Autotrader connection with IB. usually this happen after midnight, I agree this is a problem.
From time to time, some order are a sell instead of a buy and vis versa, this is as well a problem .
But, MC is improving constantly and I know that TSSupport are working on those 2 bugs actually.
I am sure TSSupport will get rid of those 2 bug soon.
Emmanuel
From time to time I may loose Autotrader connection with IB. usually this happen after midnight, I agree this is a problem.
From time to time, some order are a sell instead of a buy and vis versa, this is as well a problem .
But, MC is improving constantly and I know that TSSupport are working on those 2 bugs actually.
I am sure TSSupport will get rid of those 2 bug soon.
Emmanuel
- TJ
- Posts: 7744
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2223 times
I am not sure if that is a MultiCharts problem...Hi,
From time to time I may loose Autotrader connection with IB. usually this happen after midnight, I agree this is a problem.
From time to time, some order are a sell instead of a buy and vis versa, this is as well a problem .
But, MC is improving constantly and I know that TSSupport are working on those 2 bugs actually.
I am sure TSSupport will get rid of those 2 bug soon.
Emmanuel
GIGO... MC can only do what you have programmed it to do.
ps. with the way I trade... that's not a bad idea, I might make some money with such a feature. LOL
>
Hi Tj,
I know this may seem strange, it may sell instead of buying and vis versa
In Multichart, the program work always fine : a buy in powerlanguage is a buy on the chart, and a sell is always a sell on the chart.
But unfortunatly, sometime a communication problem appear between Multichart and IB, Multichart buy , and a sell appear on the broker interface.
This is rare.
I know this may seem strange, it may sell instead of buying and vis versa
In Multichart, the program work always fine : a buy in powerlanguage is a buy on the chart, and a sell is always a sell on the chart.
But unfortunatly, sometime a communication problem appear between Multichart and IB, Multichart buy , and a sell appear on the broker interface.
This is rare.
- TJ
- Posts: 7744
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2223 times
You can always trace your orders in MC and match them with the log in TWS.Hi Tj,
I know this may seem strange, it may sell instead of buying and vis versa
In Multichart, the program work always fine : a buy in powerlanguage is a buy on the chart, and a sell is always a sell on the chart.
But unfortunatly, sometime a communication problem appear between Multichart and IB, Multichart buy , and a sell appear on the broker interface.
This is rare.
Nothing can go astray without an audit trail.
This is a serious allegation.
If there is a problem as you claimed,
I don't think MultiCharts will take it lightly;
you should forward the logs to Tech Support
and I am sure an expert would be happy to match them for you.
-
- Posts: 103
- Joined: 05 Sep 2007
- Has thanked: 8 times
- Been thanked: 6 times
Hi Emmanuel,
Many thanks for your help.
unfortunatly, i don't obtain the same result in near old order with your code and OIG = true.
Have a good day
Many thanks for your help.
unfortunatly, i don't obtain the same result in near old order with your code and OIG = true.
Have a good day
Hi rondot
I think I see your point, and I have the solution :
You want to use the intra bar to use GetAppInfo
but you want to send the order only if a new bar appear . Here is the solution I use :
1/ you turn on the intrabar
2/ add in your strategy :
Variable: IntrabarPersist LastDateTime("");
if LastDateTime<>numtostr(TIME,0) then begin
HERE YOU PUT YOUR ORDER
end
else begin
HERE YOU USE GetAppInfo
END;
LastDateTime=numtostr(TIME,0);
Like that only GetAppInfo will be called during the intrabar
I hope this will help you
-
- Posts: 103
- Joined: 05 Sep 2007
- Has thanked: 8 times
- Been thanked: 6 times
Thanks for your reply.
please find attach 2 copy screens
only 1 trade with iog=true
please find attach 2 copy screens
only 1 trade with iog=true
- Attachments
-
- MC-AllTrades.jpg
- Signal with all trades. No intrabar
- (147.36 KiB) Downloaded 2098 times
-
- MC-IntrabaOrder.jpg
- Signal with intrabarorder true. only 1 trade
- (145.99 KiB) Downloaded 2110 times
- TJ
- Posts: 7744
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2223 times
-
- Posts: 103
- Joined: 05 Sep 2007
- Has thanked: 8 times
- Been thanked: 6 times