TP by Average Pips

Created at 27 Mar 2018, 16:42
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
TA

tasr1r1

Joined 25.12.2012

TP by Average Pips
27 Mar 2018, 16:42


In Calgo / CTrader theres an option to view all opened position by 'Aggregated' View.

In this mode, the 'Pips" column will be based on Average Pips of all opened positions

 

Currently, I am using this code to set my TP based on Average pip (AverageTakeProfit) value that i enter which in onTick.

       protected override void OnTick()
        {
            if (CountOfTradesOfType(TradeType.Buy) > 0)
                AdjustBuyPositionTakeProfits(CalculateAveragePositionPrice(TradeType.Buy), AverageTakeProfit);
            if (CountOfTradesOfType(TradeType.Sell) > 0)
                AdjustSellPositionTakeProfits(CalculateAveragePositionPrice(TradeType.Sell), AverageTakeProfit);

 

It CPU consuming and not to mentioned the notification on Ctrader mobile that cant be turn off when its modifying positions.

 

Is there any value that I can refer to the 'Pips' Column in Ctrader/Calgo so I can set i.e:

if AveragePips > AverageTakeProfit value

close (TradeType.tradetype)


@tasr1r1
Replies

tasr1r1
27 Mar 2018, 17:00

second question, can the  Symbol.PipSize be used to return total pip for all opened buy n sell?


@tasr1r1

PanagiotisCharalampous
28 Mar 2018, 09:41

Hi tasr1r1,

You can use the Pips property of every position to calculate the AveragePips. This way you will not need to modify your TP on each tick. Symbol.PipSize is not related to this case.

Best Regards,

Panagiotis


@PanagiotisCharalampous

tasr1r1
17 Apr 2018, 18:27

RE:

Panagiotis Charalampous said:

Hi tasr1r1,

You can use the Pips property of every position to calculate the AveragePips. This way you will not need to modify your TP on each tick. Symbol.PipSize is not related to this case.

Best Regards,

Panagiotis

Hi Panagiotis

 

Than you for your reply.. I managed to execute it using the method you mentioned


@tasr1r1