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
Basic MC .Net Tutorial Needed
- master.aurora
- Posts: 33
- Joined: 21 Jan 2013
- Location: Islamabad
- Has thanked: 6 times
- Been thanked: 3 times
- Contact:
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Basic MC .Net Tutorial Needed
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.
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.
- 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
Thanks for the nudge in the right direction.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.
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
- 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
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)?
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Basic MC .Net Tutorial Needed
Amount value can be modifed to change the Stop Loss/Profit Target order.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?
You need to use CurSpecOrdersMode Property. This property allows requesting or setting special orders mode: perLot, perPosition.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)?
- 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
So if i understand correctly, by recalling the GenerateProfitTarget method, the previous target is modified to the new target?Amount value can be modifed to change the Stop Loss/Profit Target order.
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
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Basic MC .Net Tutorial Needed
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.
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.
- 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
Thank you for the response.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.
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
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Basic MC .Net Tutorial Needed
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 );
}
}