Replies

Capt.Z-Partner
05 Mar 2021, 17:53 ( Updated at: 21 Dec 2023, 09:22 )

RE:

DonaldD said:

Hi Delphima, 

I am not sure if this the case, because I cannot easily reproduce it, but if it is, a way to solve it is to keep your own counter of expected open positions and execute an order only when the count of positions meets that counter e.g.

            if (Symbol.Bid >= BidAnchor && positionsCounter == Positions.Count) 
            { 
               positionsCounter++;
.
.
.

of course you will need to manage the counter accordingly e.g. decrease it when a position is closed.

 

Hi Donald,

Thanks for your idea. Yes, it is easier to reproduce the situation when the market price moving quickly. As my screenshot shows below:

I set 1.1921 as the entry price when the price bounced up passing quickly, there're 3 OnTick() run in a very short time, and BidAnchor has not updated yet, so 3 positions have been opened. After a few seconds, as I suppose, BidAnchor has been updated, and while the price passed 1.1923 again very quickly, 2 orders were sent...

 

Well, I just find a temporary solution, if we update BidAnchor just after sending the order, it will surely quicker than the next OnTick(), and it also make sure the next sell price 2 pips higher than this order send e.g Symbol.Bid. 

        if (Symbol.Bid >= BidAnchor) 
            { 
                ExecuteMarketOrder(TradeType.Sell, Symbol.Name, 1000);  
                BidAnchor = Symbol.Bid + 0.0002;
             ...

As another screenshot shows below: entry at 1.1915, every 2 pips added one order, some order's gap is higher than 2 pips, due to market orders executed according to the market price.

Thanks.


@Capt.Z-Partner

Capt.Z-Partner
15 Sep 2020, 21:12

Yes, totally support damian8's idea.  I would like to see price scale locking function in cTrader as well.


@Capt.Z-Partner

Capt.Z-Partner
02 Jul 2020, 12:31

RE:

PanagiotisCharalampous said:

Hi Delphima,

Try the below

            rsi_O = Indicators.RelativeStrengthIndex(Bars.OpenPrices, Periods);
            rsi_C = Indicators.RelativeStrengthIndex(Bars.ClosePrices, Periods);
            rsi_H = Indicators.RelativeStrengthIndex(Bars.HighPrices, Periods);
            rsi_L = Indicators.RelativeStrengthIndex(Bars.LowPrices, Periods);

Best Regards,

Panagiotis 

Join us on Telegram

 

Hi Panagiotis,

This works well. Thank you very much.:)

Lei


@Capt.Z-Partner

Capt.Z-Partner
01 Jul 2020, 16:05 ( Updated at: 21 Dec 2023, 09:22 )

RE: RE: RE:

PanagiotisCharalampous said:

Hi Delphima,

 I want to know the code below return RSI value based on last bar, but depend on which moment in the bar. Is it open price or high/close/low?

This value is calculated using the final bar values after the bar closes.

Best Regards,

Panagiotis 

Join us on Telegram

Thank you Panagiotis,

I got the reason, I need to set RSI parameter to open/close/high/low to get what I want from: rsi.Result.Last(1) 

Happy to learn new details from you.

Cheers,

Lei


@Capt.Z-Partner

Capt.Z-Partner
01 Jul 2020, 15:08

RE:

PanagiotisCharalampous said:

Hi Delphima,

The method has the same function for indicator data series as well. You code has a logical mistake though. It prints the last value when a bar is created but then compares this value with the value the indicator when the bar closed. The value of the indicator can change in the meanwhile.

Best Regards,

Panagiotis 

Join us on Telegram

Hi Panagiotis,

Yes, we are quite close to the focus of my concern.

As you said, below code 'It prints the last value when a bar is created' and 'The value of the indicator can change'. I want to know the code below return RSI value based on last bar, but depend on which moment in the bar. Is it open price or high/close/low? I didn't figure it out in the comparison. Please give more information.  Thanks.

Print("rsi.Result.Last(1) : {0}", rsi.Result.Last(1));


@Capt.Z-Partner

Capt.Z-Partner
01 Jul 2020, 14:29

RE:

PanagiotisCharalampous said:

Hi Delphima,

Last(x) uses x as a backwards index counter.  Last(1) will return the value for the previous bar, Last(2) for two bars before etc.

Best Regards,

Panagiotis 

Join us on Telegram

 

Hi Panagiotis,

Thanks for replying. 

Yes, I know Last(x) method could be used to get bars' high/low/open/close value. I wonder if it can also be used to get indicator's history value, in my example to get RSI's history value?

And, I tested with above code, it can return some value, but it's not what I expected. Can you have a look again?

Thanks,

Lei


@Capt.Z-Partner

Capt.Z-Partner
23 Jun 2020, 16:45

RE:

PanagiotisCharalampous said:

Hi Delphima,

See below

        protected override void OnBar()
        {
            Print("LastHigh: " + Bars.HighPrices.Last(1) + " LastLow: " + Bars.LowPrices.Last(1));
        }

Best Regards,

Panagiotis 

Join us on Telegram

 

Thanks Panagiotis,

I may have more questions to put to the forum, this is a great place to learn and having fun.

Thanks again.


@Capt.Z-Partner

Capt.Z-Partner
23 Jun 2020, 16:43

OK, I got the answer by searching google. Sorry for disturbing.


using cAlgo.API;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class RayLei : Robot
    {
        protected override void OnBar()
        {
            Print("High: {0}, Low: {1}", Bars.HighPrices.Last(1), Bars.LowPrices.Last(1));
        }
    }
}

 


@Capt.Z-Partner

Capt.Z-Partner
17 May 2020, 12:08

RE:

PanagiotisCharalampous said:

Hi share.axp,

There in no ETA for this feature at the moment. Demo account based strategies do not allow charging fees.

Best Regards,

Panagiotis 

Join us on Telegram

Hi Panagiotis,

I have the same problem/request. Please give update as soon as you can.

Thanks,

Lei


@Capt.Z-Partner

Capt.Z-Partner
11 May 2020, 13:30

RE:

PanagiotisCharalampous said:

Hi Delphima,

You can access cMirror here.

Best Regards,

Panagiotis 

Join us on Telegram

 

Thank you Panagiotis, 

You may consider updating the link in cMirror help centre.

Best,

Lei


@Capt.Z-Partner

Capt.Z-Partner
11 May 2020, 13:21

RE:

PanagiotisCharalampous said:

Hi Delphima,

There is no such option at the moment but when the strategy provider makes deposits to his/her account, cTrader Copy adjusts your positions so that the equity to equity ratio is restored.

Best Regards,

Panagiotis 

Join us on Telegram

 

Hi Panagiotis,

Thank you for your reply. 

I believe the equity ratio is restored and only apply to new positions, the losing position won't be adjusted. So, my understanding is that risks are still open to losing positions and to be forced closed if the price go worse...

But thank you anyway for the answer.

Best regards,

Lei


@Capt.Z-Partner

Capt.Z-Partner
09 May 2020, 03:42

I have the same question as well. Is it decided by brokers?

thanks.


@Capt.Z-Partner