As averaged in MC.net, using limit orders?
On playback its don't work.
I working only wirh market orders, but I want to use limit.
Averaging in MC.net
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Averaging in MC.net
Hello Alexxx,
Please describe in mode details what you mean exactly.
What exact version and build number of MultiCharts are you running? (in MultiCharts go to Help tab-> About)
Which broker do you use?
Are you referring to automated or manual trading ?
Please describe in mode details what you mean exactly.
What exact version and build number of MultiCharts are you running? (in MultiCharts go to Help tab-> About)
Which broker do you use?
Are you referring to automated or manual trading ?
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Averaging in MC.net
Please be more precise in your description. What happens when you place a limit order?
Please go to File -> New -> Order and position tracker window->Orders tab. What is the state of the order? Are there any error messages in the logs tab related to this order?
Please go to File -> New -> Order and position tracker window->Orders tab. What is the state of the order? Are there any error messages in the logs tab related to this order?
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Averaging in MC.net
Code: Select all
if (RetreatMode == RetreatMarketOrPending.Market)
{
MarketSearchEnterPointOfVolume();
}
if (RetreatMode == RetreatMarketOrPending.Pending)
{
PendingSearchEnterPointOfVolume();
}
void PendingSearchEnterPointOfVolume()
{
RetratStruct.FindedPoint = true;
RetratStruct.OpenPrice = Bars.Close[0];
if (CurrentPosition.Side == PowerLanguage.EMarketPositionSide.Long)
{
RetratStruct.OpenPrice = RetratStruct.OpenPrice - RetreatPendingModePoints * InstrumentInfo.Digits;
}
if (CurrentPosition.Side == PowerLanguage.EMarketPositionSide.Short)
{
RetratStruct.OpenPrice = RetratStruct.OpenPrice + RetreatPendingModePoints * InstrumentInfo.Digits;
}
RetratStruct.Side = CurrentPosition.Side;
}
void MarketSearchEnterPointOfVolume()
{
if (CurrentPosition.Side == PowerLanguage.EMarketPositionSide.Long)
{
BuyMarket.Send(FixedPanelStartCountContracts * 2);
}
if (CurrentPosition.Side == PowerLanguage.EMarketPositionSide.Short)
{
SellShortMarket.Send(FixedPanelStartCountContracts * 2);
}
}
void PendingRetreatOrders()
{
if (CurrentPosition.Side == PowerLanguage.EMarketPositionSide.Long)
{
//BuyStop.Send(RetratStruct.OpenPrice, FixedPanelStartCountContracts * 2);
if (Bars.Close[0] <= RetratStruct.OpenPrice) BuyMarket.Send(FixedPanelStartCountContracts * 2);
if (!IsFaster) Draw_TradeOrdersOnChart(RetratStruct.OpenPrice, "Enter RetreatLong", Bars.TimeValue, "OliveDrab");
}
if (CurrentPosition.Side == PowerLanguage.EMarketPositionSide.Short)
{
//SellShortStop.Send(RetratStruct.OpenPrice, FixedPanelStartCountContracts * 2);
if (Bars.Close[0] >= RetratStruct.OpenPrice) SellShortMarket.Send(FixedPanelStartCountContracts * 2);
if (!IsFaster) Draw_TradeOrdersOnChart(RetratStruct.OpenPrice, "Enter RetreatShort", Bars.TimeValue, "OliveDrab");
}
}
void Trading_IsRetreat(string Mode)
{
if (CurrentPosition.Side != PowerLanguage.EMarketPositionSide.Flat)
{
//double TP = Convert.ToDouble(ExitTakePrice[ExitTakePrice.Count - 1]);
double TP = Trading.TakeProfit;
//double SL = Convert.ToDouble(ExitStopPrice[ExitStopPrice.Count - 1]);
double SL = Trading.StopLoss;
if (CurrentPosition.Side == PowerLanguage.EMarketPositionSide.Long)
{
if (CurrentPosition.OpenLots == FixedPanelStartCountContracts)
{
if (RetreatMode == RetreatMarketOrPending.Pending) PendingRetreatOrders();
// БУ по Retreat Long - не проверено
SellLimit.Send(StrategyInfo.AvgEntryPrice + InstrumentInfo.Digits, CurrentPosition.OpenLots);
if (!IsFaster) Draw_TradeOrdersOnChart(StrategyInfo.AvgEntryPrice + InstrumentInfo.Digits, "No Loss for Long", Bars.TimeValue, "OliveDrab");
}
if (CurrentPosition.OpenLots > FixedPanelStartCountContracts)
{
SellStop.Send(SL, CurrentPosition.OpenLots);
if (!IsFaster) Draw_TradeOrdersOnChart(SL, "2*SL Long in " + Mode, Bars.TimeValue, "OrangeRed");
SellLimit.Send(TP, CurrentPosition.OpenLots);
if (!IsFaster) Draw_TradeOrdersOnChart(TP, "TP Long in " + Mode, Bars.TimeValue, "OliveDrab");
}
}
if (CurrentPosition.Side == PowerLanguage.EMarketPositionSide.Short)
{
if (CurrentPosition.OpenLots == FixedPanelStartCountContracts)
{
if (RetreatMode == RetreatMarketOrPending.Pending) PendingRetreatOrders();
BuyToCoverLimit.Send(StrategyInfo.AvgEntryPrice - InstrumentInfo.Digits, CurrentPosition.OpenLots);
if (!IsFaster) Draw_TradeOrdersOnChart(StrategyInfo.AvgEntryPrice - InstrumentInfo.Digits, "No Loss for Short", Bars.TimeValue, "OliveDrab");
}
if (CurrentPosition.OpenLots > FixedPanelStartCountContracts)
{
BuyToCoverStop.Send(SL, CurrentPosition.OpenLots);
if (!IsFaster) Draw_TradeOrdersOnChart(SL, "2*SL Short in " + Mode, Bars.TimeValue, "OrangeRed");
BuyToCoverLimit.Send(TP, CurrentPosition.OpenLots);
if (!IsFaster) Draw_TradeOrdersOnChart(TP, "TP Sell in " + Mode, Bars.TimeValue, "OliveDrab");
}
}
}
}
protected override void CalcBar()
{
if (Bars.LastBarOnChart)
{
if (TradeModes.IsRetreat) Trading_IsRetreat("Trend");
}
}
PendingSearchEnterPointOfVolume() - don`t work
Last edited by Alexxx on 21 Sep 2014, edited 1 time in total.
Re: Averaging in MC.net
Nothing happens. The situation is tested for playback, so there is no logs and records in the Order and position tracker window.Please be more precise in your description. What happens when you place a limit order?
Please go to File -> New -> Order and position tracker window->Orders tab. What is the state of the order? Are there any error messages in the logs tab related to this order?
Earlier I posted the source code that handles this situation.