NexusFi: Find Your Edge


Home Menu

 





Multicharts automated trading with Interactive Brokers


Discussion in MultiCharts

Updated
    1. trending_up 595 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 7 posts
    2. attach_file 0 attachments




 
 

Multicharts automated trading with Interactive Brokers

 
Abaci
Bilbao,Spain
 
Posts: 9 since Jul 2023
Thanks Given: 3
Thanks Received: 3

Hi,

I switched recently part of my trading from Tradestation to Interactive Brokers using Multicharts, but I have encountered some problems. I dont know if this is a Multicharts thing or the way that IB handles orders. The strategy code that I run is like this:

{ Entry orders }
If Conditions then
Buy("EnStop-L") NShares shares next bar at EntPrL stop;

If Conditions then
Sell Short("EnStop-S") NShares shares next bar at EntPrS stop;

{ Exit orders, long trades }
If MarketPosition = 1 then begin
If BarsSinceEntry = 0 then
LStop = (1 - MMStopPctL/100.0) * EntryPrice;

Sell("ExStop-L") next bar at LStop stop;

If condition then
Sell("ExMark-L") next bar at market;
end;

{ Exit orders, short trades }
If MarketPosition = -1 then begin
If BarsSinceEntry = 0 then
SStop = EntryPrice + MMFrS * TrueRange;

Buy to cover("ExStop-S") next bar at SStop stop;

If condition
Buy to cover("ExMark-S") next bar at market;
end;


Is there any problem with that code in multicharts powerlanguage? or maybe are there some details that I could be missing while automating with IBKR??. This is a strategy that is running in 60 minutes bars in Corn Futures, I have another strategies in different futures and I dont have any problems with them apparently


Can you help answer these questions
from other members on NexusFi?
Cheap historycal L1 data for stocks
Stocks and ETFs
REcommedations for programming help
Sierra Chart
OrderFlow-Based Support/Resistance Levels
Emini and Emicro Index
Quantum physics & Trading dynamics
The Elite Circle
What broker to use for trading palladium futures
Commodities
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
22 thanks
Funded Trader platforms
16 thanks
ApexTraderFunding.com experience and review
13 thanks
Trading with Intuition
12 thanks
GFIs1 1 DAX trade per day journal
9 thanks
 
 kevinkdog   is a Vendor
 
Posts: 3,666 since Jul 2012
Thanks Given: 1,892
Thanks Received: 7,360


Abaci View Post
Hi,

I switched recently part of my trading from Tradestation to Interactive Brokers using Multicharts, but I have encountered some problems. I dont know if this is a Multicharts thing or the way that IB handles orders. The strategy code that I run is like this:

{ Entry orders }
If Conditions then
Buy("EnStop-L") NShares shares next bar at EntPrL stop;

If Conditions then
Sell Short("EnStop-S") NShares shares next bar at EntPrS stop;

{ Exit orders, long trades }
If MarketPosition = 1 then begin
If BarsSinceEntry = 0 then
LStop = (1 - MMStopPctL/100.0) * EntryPrice;

Sell("ExStop-L") next bar at LStop stop;

If condition then
Sell("ExMark-L") next bar at market;
end;

{ Exit orders, short trades }
If MarketPosition = -1 then begin
If BarsSinceEntry = 0 then
SStop = EntryPrice + MMFrS * TrueRange;

Buy to cover("ExStop-S") next bar at SStop stop;

If condition
Buy to cover("ExMark-S") next bar at market;
end;


Is there any problem with that code in multicharts powerlanguage? or maybe are there some details that I could be missing while automating with IBKR??. This is a strategy that is running in 60 minutes bars in Corn Futures, I have another strategies in different futures and I dont have any problems with them apparently

Can you explain what problems you had, in detail?

Follow me on Twitter
 
Abaci
Bilbao,Spain
 
Posts: 9 since Jul 2023
Thanks Given: 3
Thanks Received: 3



kevinkdog View Post
Can you explain what problems you had, in detail?

HI Kevin,

From what I can see, the strategy generates orders and sents them to TWS, but when a 60 minute bar passes the strategy doesnt send new recalculated orders to interactive brokers and thge older ones remains active. Note that in backtest the strategy works well ( it generates the same trades in MC and in TS) but in live trading I have that issue.

Thanks

 
 kevinkdog   is a Vendor
 
Posts: 3,666 since Jul 2012
Thanks Given: 1,892
Thanks Received: 7,360


Abaci View Post
HI Kevin,

From what I can see, the strategy generates orders and sents them to TWS, but when a 60 minute bar passes the strategy doesnt send new recalculated orders to interactive brokers and thge older ones remains active. Note that in backtest the strategy works well ( it generates the same trades in MC and in TS) but in live trading I have that issue.

Thanks

There could be a setting with Multicharts where the order only gets sent when the order is filled, then it would not be lingering at IB.

Follow me on Twitter
 
Abaci
Bilbao,Spain
 
Posts: 9 since Jul 2023
Thanks Given: 3
Thanks Received: 3


kevinkdog View Post
There could be a setting with Multicharts where the order only gets sent when the order is filled, then it would not be lingering at IB.

Thanks for the response Kevin, I'll continue investigating about that, maybe someone else knows how to setup up that correctly on MC+IB.

 
 
andby's Avatar
 andby 
Norwich, UK
 
Experience: Intermediate
Platform: Multiple:research&executi
Broker: Started with Stage5/OEC ... multiple
Trading: Anything found profitable goes ...
Posts: 168 since Jul 2012
Thanks Given: 88
Thanks Received: 88

this is simple enough to be translated to Multicharts.Net where you'd be better troubleshooting in terms of what happens. Just roughly looking at this, you're missing an end after the first being. You might also enforce recalculation after every bar (I think there is a flab/GUI option for this) - but recalculation happens automatically on every bar close regardless of broker/data-provider ... is my expectation anyways ...

Out of curiosity, since I may switch to IB myself ... how is your experience so far on IB + Multicharts?

 
Abaci
Bilbao,Spain
 
Posts: 9 since Jul 2023
Thanks Given: 3
Thanks Received: 3

Apart from that specific strategy that It had to be turned off, my experience has been good. I still prefer Tradestation though, maybe because being broker+platform helps.

 
 
andby's Avatar
 andby 
Norwich, UK
 
Experience: Intermediate
Platform: Multiple:research&executi
Broker: Started with Stage5/OEC ... multiple
Trading: Anything found profitable goes ...
Posts: 168 since Jul 2012
Thanks Given: 88
Thanks Received: 88


Abaci View Post
Apart from that specific strategy that It had to be turned off, my experience has been good. I still prefer Tradestation though, maybe because being broker+platform helps.

Tradestation 10 is dog food for the moment, cannot comprehend how is their QA working. Between sticking to 9.5 which is quickly becoming obsolete and embracing something better maintained w/ more up to date software (not saying Multicharts is miles ahead of TS - as they're barely moving the needle forward - for example, MC.NET is using an out of date / out of support .NET platform ... ), Multicharts is definitely ahead of TS.


 



Last Updated on December 19, 2023


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts