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

PanagiotisCharalampous
25 Apr 2019, 11:04

Hi jonkey,

Try this approach and let me know if it works for you

            var source = MarketData.GetSeries(TimeFrame.Daily);
            sma = Indicators.SimpleMovingAverage(source.Close, smaPeriod);

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Apr 2019, 10:09

Hi Sasha,

I haven't tried it but should work for m1 bars.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Apr 2019, 09:48

Hi mariusgunnerud,

Try this

PendingOrders.Count(x => x.SymbolCode == Symbol.Name);

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Apr 2019, 09:44

Hi tgjobscv,

No this is not possible and doesn't make much sense e.g. if you set a Sell Limit at 1.2 and it is triggered when the price crosses below 1.2 then the order will not be filled since the price will be below the limit. Why do you need this?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Apr 2019, 09:34

Hi DelTrader,

I do not see anything wrong in this code. Can you share the complete cBot code? Make sure you are setting the labels correctly.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
24 Apr 2019, 17:23

Hi dominhtri1995,

No the indicator will not run on a previous version.However soon all brokers will be updated to 3.5.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
24 Apr 2019, 16:45

Hi andi21,

Please note that this applies only for built in SL and TP. If you have a custom made logic, like below, then your execution will not be accurate

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewcBot : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        protected override void OnStart()
        {
            ExecuteMarketOrder(TradeType.Buy, Symbol.Name, 1000);
        }

        protected override void OnTick()
        {
            if (Positions.Count > 0 && Positions[0].Pips < -2)
                Positions[0].Close();

        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
24 Apr 2019, 16:27 ( Updated at: 21 Dec 2023, 09:21 )

Hi andi21,

The cBot will honor the SL and TP prices regardless the fact that only m1 bar data is used. See the example below

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewcBot : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        protected override void OnStart()
        {
            ExecuteMarketOrder(TradeType.Buy, Symbol.Name, 1000, "", 2, 100);
        }

        protected override void OnTick()
        {
            Print("Test");
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

and see where the SL is triggered

The difference with the tick data execution is that the OnTick() function is called only when the bar changes (hence the print statement in OnTick() for demonstration). So if you have logic in OnTick() method, backtesting on bars is not recommended. 

Best Regards,

Panagiots


@PanagiotisCharalampous

PanagiotisCharalampous
24 Apr 2019, 16:04

Hi andi21,

Based on your image, I would expect the SL to trigger on the opening of the third yellow bar. Is this what you expect as well?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
24 Apr 2019, 14:29

Hi andi21,

Do you have a scenario where we can see this behavior (cBot, cBot parameters, backtesting dates)?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
24 Apr 2019, 11:50

Hi lec0456,

To fix the issue, you need to delete the settings file located in C:\Users\<USER NAME>\AppData\Roaming\FxPro-cTrader\Settings. Before you delete it, please send it to us for further investigation.

Best Regards,

Panagiotis

 


@PanagiotisCharalampous

PanagiotisCharalampous
24 Apr 2019, 11:30

Hi lec0456,

Thanks, we received and we are checking.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
24 Apr 2019, 10:22

Hi Jonkey,

Can you please send us some troubleshooting information when this happens again? To do so press Ctrl+Alt+Shift+T, paste the link to this discussion inside the text box and press Submit. Let me know when you do it so that we can check.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
24 Apr 2019, 10:19

Hi lec0456,

Can you please try a clean installation? If it is insists, please post a screenshot of the error message.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
24 Apr 2019, 10:16

Hi DelTrader,

Can you please explain to us what is the problem?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
24 Apr 2019, 10:10

Hi enrikeyo,

Thank you for posting in our forum. The issue is in the following line of code

this.nemethHAH4 = Indicators.GetIndicator<NemethHA>(MarketSeries.Close);

You are initializing an indicator with a parameter, however the indicator does not take any input parameters.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
24 Apr 2019, 10:08

Hi trader.calgo,

Can you please provide more information e.g. a cBot, some screenshots etc?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
23 Apr 2019, 17:37

Hi trader.calgo,

While building in Visual Studio, just change the platform from Any CPU to x64.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
23 Apr 2019, 16:45

Hi jumpycalm,

You are not correct :) You can set trailing stop losses from the API as well. See here.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
23 Apr 2019, 16:22

Hi ryanoia@gmail.com,

Ok. So are you saying that with the second indicator, it is possible, it's just that I have to add functionality in the pivot point cBot code for the cBot to access the support and resistance levels in the indicator? 

Yes this is what I mean.

Best Regards,

Panagiotis 


@PanagiotisCharalampous