NexusFi: Find Your Edge


Home Menu

 





Multicharts.Net order handling help needed


Discussion in MultiCharts

Updated
    1. trending_up 3,709 views
    2. thumb_up 4 thanks given
    3. group 2 followers
    1. forum 12 posts
    2. attach_file 1 attachments




 
Search this Thread

Multicharts.Net order handling help needed

  #1 (permalink)
 MarcOne 
Milan, Italy
 
Experience: Intermediate
Platform: Ninja
Trading: 6E, CL, GC
Posts: 9 since Oct 2011
Thanks Given: 5
Thanks Received: 0

Good morning to everone, this is my first post so I hope to be in right place..
I've lot of troubles in understanding orders handling in MC .Net.. I seached a lot for infos but at the end I'm still in confusionary state. I know there are managed and unmanaged orders and orders for backtests and other for RT..
Someone of you can please help me in understanding what are the right codes to give?
I compiled a simple breackout strategy (my first one) to test orders.
My need is to have one order long and one short, OCO, but I can't submit them every candle, they must stay till I cancel or move them.. When in position (i.e. long) I need to cancel the remaining short order and send stop and target order.. I know it should be simple, but, while for NT I had no problem, with MC I'm in big trouble.. Here some infos:

Strategy order init:
[AllowSendOrdersAlways(true), IOGMode(IOGMode.Disabled), SameAsSymbol(true)]

Order init:
m_entryLong_BuyOrder = OrderCreator.Stop(new SOrderParameters(Contracts.UserSpecified, "EntryLong", EOrderAction.Buy));
m_exitMarket_SellOrder = OrderCreator.MarketThisBar(new SOrderParameters(Contracts.UserSpecified, "ExitLMStop", EOrderAction.Sell));
m_exitStop_SellOrder = OrderCreator.Stop(new SOrderParameters(Contracts.UserSpecified, "LStopOrder", EOrderAction.Sell));

m_entryShort_SellOrder = OrderCreator.Stop(new SOrderParameters(Contracts.UserSpecified, "EntryShort", EOrderAction.SellShort));
m_exitStop_BuyOrder = OrderCreator.Stop(new SOrderParameters(Contracts.UserSpecified, "SStopOrder", EOrderAction.BuyToCover));
m_exitMarket_BuyOrder = OrderCreator.MarketThisBar(new SOrderParameters(Contracts.UserSpecified, "ExitSMStop", EOrderAction.BuyToCover));

I put orders (m_entryLong_BuyOrder, m_entryShort_SellOrder)but they’re cancelled every new bar..
Any help would be gratly appreciated..
Thanks in advance!

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
Increase in trading performance by 75%
The Elite Circle
MC PL editor upgrade
MultiCharts
Trade idea based off three indicators.
Traders Hideout
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
18 thanks
GFIs1 1 DAX trade per day journal
16 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
13 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

MarcOne,

I would suggest to start with the managed approach, which is what you did already anyway.
Most of the time you send an order in Multicharts when a certain condition is true. Multicharts will keep this order alive as long as this condition is valid (or until you get filled). This way you can control how long orders stay alive by simply making sure the condition for the order stays valid as long as you want.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #3 (permalink)
 MarcOne 
Milan, Italy
 
Experience: Intermediate
Platform: Ninja
Trading: 6E, CL, GC
Posts: 9 since Oct 2011
Thanks Given: 5
Thanks Received: 0


Thanks ABCTG, I was wondering how was the approach of MC in managed orders handling..
Maybe useful for other people to know my noob exp using managed approach.
My troubles were born when I've read here in post #11 that the orders must be resubmitted every candle (or tick if using IOG mode=on). It was just a question of misunderstanding..

What MC does is, as you write, simply to keep order alive. This means, from broker side, that no change take place.. no change in priority, no change in broker order ID.. Nothing happens to your order!

Basically I can say that MC simply validate the existing order inside itself. If, for some reason, the order is no longer valid, MC cancel it. It can also be considered a security improvement, from my point of view.

I’ve to thank also Jura for this article, very useful for me.

Now I’ll continue my tests, testing all types of orders..
If I’m right, the managed order should work both for BT and RT mode.. (Of couse there will be differencies, I just hope not so big)

Is there something I should know before in placing take profit/stop orders? This article gave me the idea in how they should work, but any help is greatly appreciated. Thanks again

Started this thread Reply With Quote
  #4 (permalink)
 MarcOne 
Milan, Italy
 
Experience: Intermediate
Platform: Ninja
Trading: 6E, CL, GC
Posts: 9 since Oct 2011
Thanks Given: 5
Thanks Received: 0

Does exist ( and if yes how is it called ) a flag that I can insert into the code to verify if the strategy is activated or not? I mean, is SA activated returns true, if SA not active returns false?
Thanks in advance!!

Started this thread Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

Yes, something like that exists. You can access it via the Environment property. In your case you are looking for Environment.IsAutoTradingMode.

Regards,

ABCTG



MarcOne View Post
Does exist ( and if yes how is it called ) a flag that I can insert into the code to verify if the strategy is activated or not? I mean, is SA activated returns true, if SA not active returns false?
Thanks in advance!!


Follow me on Twitter Reply With Quote
Thanked by:
  #6 (permalink)
 MarcOne 
Milan, Italy
 
Experience: Intermediate
Platform: Ninja
Trading: 6E, CL, GC
Posts: 9 since Oct 2011
Thanks Given: 5
Thanks Received: 0

Thanks a lot ABCTG, I solved this issue, but now I'm facing another one.. hope you can help me again, without abusing of your kindness..

This is my trouble:
I'm not able to put (and follow) multiple limit orders. I built a breakout strategy. I made a strategy only for long entries and a strategy with only shorts. I'm using limit orders (no market executions). Everything is working fine with one entry. Now I'd like to use multiple entries using limits orders. No way.. the new limit order (if I'm already in position) is not handled at all. I can only wait till the strategy is flat. On the other I'm able to send market orders..
What is the logic of Multicharts? May I get an unic order Id to handle like in Ninjatrader?
I'm confused.. Do you have any suggestion?

Thanks a lot in advance..



ABCTG View Post
Yes, something like that exists. You can access it via the Environment property. In your case you are looking for Environment.IsAutoTradingMode.

Regards,

ABCTG


Started this thread Reply With Quote
  #7 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

MarcOne,

what settings are you using under the Properties in the "Strategy Properties" tab for "Position Limits"? By default
MC will only allow one entry in the same direction, so not allowing more than one would block all further entry orders (until you are flat again).

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #8 (permalink)
 MarcOne 
Milan, Italy
 
Experience: Intermediate
Platform: Ninja
Trading: 6E, CL, GC
Posts: 9 since Oct 2011
Thanks Given: 5
Thanks Received: 0

Thanks for your response, I've to say that I tried all the options, and I can't get the solution..
I'm surely wrong in something I can't understand.. 7I attach the current settings, maybe you can give some hint.
Thanks Again



ABCTG View Post
MarcOne,

what settings are you using under the Properties in the "Strategy Properties" tab for "Position Limits"? By default
MC will only allow one entry in the same direction, so not allowing more than one would block all further entry orders (until you artried e flat again).

Regards,

ABCTG


Started this thread Reply With Quote
  #9 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

MarcOne,

it's hard to tell from that screenshot as the settings appear correct. Is there enough capital left for allowing additional entries and does the first entry use less than 5 contracts?
You could post your code so others can take a look at it and point you in the right direction. This doesn't mean you have to reveal your actual entry logic, as you can replace it with something else - so long the code still verifies and demonstrates the same behavior.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #10 (permalink)
 MarcOne 
Milan, Italy
 
Experience: Intermediate
Platform: Ninja
Trading: 6E, CL, GC
Posts: 9 since Oct 2011
Thanks Given: 5
Thanks Received: 0


Well I'm in simulated mode so the capital left is ok (100.000 $), every entry is 1 contract.
I'll post the code as soon as I arrive in office (tomorrow). But just let me understand if MC handle multiple entries like the one I need ( using limit multiple orders while I'm already in position)..
Thanks Again!



ABCTG View Post
MarcOne,

it's hard to tell from that screenshot as the settings appear correct. Is there enough capital left for allowing additional entries and does the first entry use less than 5 contracts?
You could post your code so others can take a look at it and point you in the right direction. This doesn't mean you have to reveal your actual entry logic, as you can replace it with something else - so long the code still verifies and demonstrates the same behavior.

Regards,

ABCTG


Started this thread Reply With Quote




Last Updated on January 26, 2017


© 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