Basic MC .Net Tutorial Needed

Questions about MultiCharts .NET and user contributed studies.
User avatar
master.aurora
Posts: 33
Joined: 21 Jan 2013
Location: Islamabad
Has thanked: 6 times
Been thanked: 3 times
Contact:

Basic MC .Net Tutorial Needed

Postby master.aurora » 29 Jan 2013

Hello Guys,

As the subject clearly states that i need help with some very basci stuff in MC .Net. All i need to do at te moment to get myself up and running is:

1. Send an order.
2. Upon its fill order execution), i need to place TP & SL for this trade and handle them.

And then, i would want to backtest this.

I would love to get any sort of help from the experts here. Hoping to get some positive response.

Thanks,
Umer

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Basic MC .Net Tutorial Needed

Postby Henry MultiСharts » 29 Jan 2013

Hello Umer,

You can find the code examples in the source code of the prebuilt MultiCharts studies.
Please go to PowerLanguage .Net editor->Open to view the full list of studies.
1) Market order entry and exit command examples can be found in Custom_Strategy signals;
2) Please refer to Profit_Target and Stop_loss signals.

User avatar
master.aurora
Posts: 33
Joined: 21 Jan 2013
Location: Islamabad
Has thanked: 6 times
Been thanked: 3 times
Contact:

Re: Basic MC .Net Tutorial Needed

Postby master.aurora » 06 Feb 2013

Hello Umer,

You can find the code examples in the source code of the prebuilt MultiCharts studies.
Please go to PowerLanguage .Net editor->Open to view the full list of studies.
1) Market order entry and exit command examples can be found in Custom_Strategy signals;
2) Please refer to Profit_Target and Stop_loss signals.
Thanks for the nudge in the right direction.

Now, i have another question. What if i want to modify the Stop Loss Target (GenerateStopLoss) or the Profit Target (GenerateProfitTarget) for an order i have already set. Is there a way to make that happen?

Hoping to hear form you soon.

Thanks.
Umer

User avatar
master.aurora
Posts: 33
Joined: 21 Jan 2013
Location: Islamabad
Has thanked: 6 times
Been thanked: 3 times
Contact:

Re: Basic MC .Net Tutorial Needed

Postby master.aurora » 06 Feb 2013

Also, to add to my question, are the Profit Target & Stop Loss set against a specific order or against the cummulative position that is opened (all the open orders)?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Basic MC .Net Tutorial Needed

Postby Henry MultiСharts » 06 Feb 2013

Now, i have another question. What if i want to modify the Stop Loss Target (GenerateStopLoss) or the Profit Target (GenerateProfitTarget) for an order i have already set. Is there a way to make that happen?
Amount value can be modifed to change the Stop Loss/Profit Target order.
Also, to add to my question, are the Profit Target & Stop Loss set against a specific order or against the cummulative position that is opened (all the open orders)?
You need to use CurSpecOrdersMode Property. This property allows requesting or setting special orders mode: perLot, perPosition.

User avatar
master.aurora
Posts: 33
Joined: 21 Jan 2013
Location: Islamabad
Has thanked: 6 times
Been thanked: 3 times
Contact:

Re: Basic MC .Net Tutorial Needed

Postby master.aurora » 06 Feb 2013

Amount value can be modifed to change the Stop Loss/Profit Target order.
So if i understand correctly, by recalling the GenerateProfitTarget method, the previous target is modified to the new target?
Also, what will happen in the following condition:
I open a new buy order for lets suppose; AAPL. Immediatley after calling the Send method on that order i call the GenerateProfitTarget & GenerateStopLoss methods. If on the next bar i want to open another Buy order and want to set the Take Profit & Stop Loss for that too, how can i achieve that?

Thanks for the prompt responses.

Regards.
Umer

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Basic MC .Net Tutorial Needed

Postby Henry MultiСharts » 08 Feb 2013

You do not need to recall the GenerateProfitTarget method. You just need to change the amount value.
When you modify the amount value with a single entry - the order is modified in both modes-per contract and per position.

In multiple entries in the same direction mode the orders and their amount would be automatically adjusted. The order price would be also adjusted in case you are modifying the Amount value.

User avatar
master.aurora
Posts: 33
Joined: 21 Jan 2013
Location: Islamabad
Has thanked: 6 times
Been thanked: 3 times
Contact:

Re: Basic MC .Net Tutorial Needed

Postby master.aurora » 11 Feb 2013

You do not need to recall the GenerateProfitTarget method. You just need to change the amount value.
When you modify the amount value with a single entry - the order is modified in both modes-per contract and per position.

In multiple entries in the same direction mode the orders and their amount would be automatically adjusted. The order price would be also adjusted in case you are modifying the Amount value.
Thank you for the response.

Though, i am unable to find the property to modify or any method to change the amount. Can you point me in the right direction?

Thanks,
Umer

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Basic MC .Net Tutorial Needed

Postby Henry MultiСharts » 11 Feb 2013

This code will increase the Amount value on each calculation:

Code: Select all

int amount = 1;
protected override void CalcBar()
{
buy_order.Send();
GenerateProfitTarget(amount);

if(Bars.Time[0] != Bars.Time[1] && Bars.LastBarOnChart)
{
amount++;
Output.WriteLine("{0}", amount );
}
}


Return to “MultiCharts .NET”