PanagiotisCharalampous's avatar
PanagiotisCharalampous
26 follower(s) 0 following 1006 subscription(s)
Replies

PanagiotisCharalampous
23 May 2019, 10:15

Hi tomopeov,

It would look something like this

        protected override void OnStart()
        {
            Positions.Closed += Positions_Closed;
        }

        private void Positions_Closed(PositionClosedEventArgs obj)
        {
            if (obj.Reason == PositionCloseReason.TakeProfit)
            {
                if (obj.Position.TradeType == TradeType.Buy)
                {
                   PlaceStopOrder(TradeType.Sell, Symbol, obj.Position.VolumeInUnits, obj.Position.EntryPrice);                 
                }
                else
                {
                    PlaceStopOrder(TradeType.Buy, Symbol, obj.Position.VolumeInUnits, obj.Position.EntryPrice);
                }
            }
        }

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
23 May 2019, 10:02

Hi alex_mihail,

If you just want to print text on the chart then you can use Chart.DrawText() function.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
23 May 2019, 09:58

Hi wisegprs,

Calculate() gets triggered on each tick, that's why. You need to run your code only when the bar count changes.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
23 May 2019, 09:56

Hi yosifiv,

StopOutLevel is related with the level your margin has to reach in order for the stop out process to start. If you just want to modify your position when your equity reaches 50% of the balance just use a condition like below

 if(Account.Equity < Account.Balance * 0.5)

If you want to start stopping out your positions when margin falls below StopOutLevel then you first need to calculate the margin used. In this case, this discussion might be helpful.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
22 May 2019, 15:42 ( Updated at: 21 Dec 2023, 09:21 )

Hi mukkacow,

Thanks for posting in our forum. Please make sure that the notifications sound is turned on for the application. See below

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
22 May 2019, 15:38

Hi UFO1,

Thanks for posting in our forum. There is no such property in the Position class at the moment.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
22 May 2019, 15:36

Hi yosifov,

Your request is not clear. What do you want to use this for?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
22 May 2019, 09:51

Hi Eliezer,

Even though we are trying to make backtesting results as close as possible to the real time execution, it is not always possible. At the moment we do not have historical data about the swaps. commissions or market depth therefore you should expect some deviation of the backtesting results when compared to real time execution.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
22 May 2019, 09:46

Hi Alex,

Just set the indicator attribute to IsOverlay to true. See below

[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
20 May 2019, 16:17

Hi nmaxcom,

I mean that since you closed the last position and until the end of the backtesting, the equity fluctuated between 6344.63 and 4980.22. It is seems there is a position open when the backtesting is completed.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
20 May 2019, 10:33

Hi zedodia,

The stop loss should be set in pips but you pass a price instead. You need to convert it into pips or use ModifyStopLossPrice after the position is opened.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
20 May 2019, 10:30

Hi zedodia,

Can you check the log in case there are any errors there?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
20 May 2019, 10:29

Hi nmaxcom,

There is no issue here. No positions are cut off or lost on ending the backtesting. What you are showing to us is the values that the equity fluctuated in between since closing the last position. To see the equity of the account when backtesting stopped, please check the Trade Statistics tab.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
20 May 2019, 10:24

Hi nmaxcom,

The filter is for ROI to be above 50% for the last week. What you are showing to us is the All Time ROI.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
20 May 2019, 09:19

Hi bishbashbosh,

We had a look at this behavior. It is caused because you are using Stop Limit orders. If the execution price of the order falls outside the range of the order, it will be cancelled.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
17 May 2019, 17:32

Hi jarvischo,

Let me know if this helps.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
17 May 2019, 15:48

Hi Lukas,

It is not possible to have an array as an input parameter. You can get the values as string and use string.Split() to make the separation into an array.

Best Regards,

Panagiotis

 


@PanagiotisCharalampous

PanagiotisCharalampous
17 May 2019, 14:46

Hi Symposium,

This is already available in Symbol parameter. See below

  Print(Symbol.Code);

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
17 May 2019, 14:43

Hi zedodia,

Can you please explain why do you think it does not work? I ran a backtesting and I get trades.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
17 May 2019, 14:37

Hi bishbashbosh,

In the absence of anyone from cTrader replying, I would be very interested if anyone else runs the above code and does/does not see the same behaviour.

We managed to reproduce and we are investigating :)  we will reply!

Best Regards,

Panagiotis 


@PanagiotisCharalampous