Topics

Forum Topics not found

Replies

amusleh
05 Apr 2022, 09:44

RE: RE: RE: Code to make this work?

william@hallsdesign.co.uk said:

 

Hi,

 

I have been going round in circles with this, and all I want is the current price of a pair I have. I have everything, all my code is placing a trade etc.. But only if I manually add the price in for my pair and run my code.

I have tried all the subscribing and ProtoOASpotEvent stuff. If you wouldnt mind helping me out with the exact code you did, that would be greatly appreciated. I just wish they would allow you to place a market order with a stopLoss and takeProfit without having to faff with all of this!!

Thanks in advance

 

William

Hi,

To receive live quotes of a symbol you have to send a ProtoOASubscribeSpotsReq, after that you will keep receiving ProtoOASpotEvent(s) which will contain the latest symbol bid/ask prices.

For code example please check the console sample of OpenApiPy: OpenApiPy/main.py at main · spotware/OpenApiPy (github.com)

For creating a new market order you have to send a ProtoOANewOrderReq: OpenApiPy/main.py at 50b00db0a2570d4cb62ab0a191501f49aa5ea191 · spotware/OpenApiPy (github.com)

You can set the stop loss and take profit in relative: Messages - cTrader Open API (spotware.github.io)


@amusleh

amusleh
05 Apr 2022, 09:39

Hi,

Can you please provide the steps to reproduce the doubling issue? we tried but we were not able to reproduce this issue.


@amusleh

amusleh
05 Apr 2022, 09:37

Hi,

You can use the trendbar utcTimestampInMinutes fields, if it changes then it means a new bar is opened.

If there is no activity then there will be no bars.


@amusleh

amusleh
05 Apr 2022, 09:36

Hi,

You can use cMAM: cMAM - Copy cTrader Trades - AlgoDeveloper


@amusleh

amusleh
04 Apr 2022, 13:21

RE:

Jobauma said:

Thanks.

Indicators not refreshing automatically is huge problem. :)

Refresh from right-click is temporary/long-term solution.

Best regards,

Johannes Hillestad Baumann

Hi,

What do you mean by indicator not refreshing automatically?


@amusleh

amusleh
04 Apr 2022, 11:58

Hi,

Can you try it with Robot AccessRights set to FullAccess?


@amusleh

amusleh
04 Apr 2022, 11:22

Hi,

We were able to reproduce this issue and it will be fixed on next release of beta version, thanks for reporting!


@amusleh

amusleh
04 Apr 2022, 10:28

Hi,

I don't see any issue, the problem is you are using daily OHLC data instead of m1 (one minute) bars data.

If you want to use custom data for back test you have to use M1 bars data not daily bars.


@amusleh

amusleh
04 Apr 2022, 10:04 ( Updated at: 04 Apr 2022, 10:08 )

Hi,

It happens because your indicator namespace and class names are same, try this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace Test40
{
    [Indicator(AccessRights = AccessRights.None)]
    public class Test40 : Indicator
    {
        [Parameter(DefaultValue = "Hello world!")]
        public string Message { get; set; }

        [Output("Main")]
        public IndicatorDataSeries Result { get; set; }

        public Test.Test ind;

        protected override void Initialize()
        {
            // To learn more about cTrader Automate visit our Help Center:
            // https://help.ctrader.com/ctrader-automate

            ind = Indicators.GetIndicator<Test.Test>("Another Indicator");

            Print(Message);
        }

        public override void Calculate(int index)
        {
            // Calculate value at specified index
            // Result[index] =
        }
    }
}

 


@amusleh

amusleh
04 Apr 2022, 10:03

Hi,

It's not on our current roadmap as far as I know, but you can create a thread on suggestions section.

We might add these type of features for cTrader extensions/plug-ins which is on our plan.


@amusleh

amusleh
04 Apr 2022, 09:50

Hi,

I just tested it on both cTrader 4.1 (IC Markets) and 4.2 (Spotware Beta) and it works fine, it doesn't display any NAN value.


@amusleh

amusleh
04 Apr 2022, 09:47

Hi,

Are you using the Spotware cTrader Beta 4.2? or your broker cTrader? Which version of cTrader you are using?

The new cTrader 4.2 is backward compatible.


@amusleh

amusleh
04 Apr 2022, 09:46 ( Updated at: 21 Dec 2023, 09:22 )

RE: RE:

uvwxyz said:

amusleh said:

Hi,

Try to change the compiler from your cTrader settings to SDK compiler, the default one is embeded compiler which has limited functionality.

cTrader 4.2 is not released for any broker yet, it's only available as beta on Spotware cTrader beta.

 

 

Hi  amusleh,

I tried doing this, but I can't find how to do this  in a Demo Account.

I tried looking for cTrader Settings in he Credentials Details. But didn't find the Settings.

Thanks for any help. 

You can change the compiler by going to cTrader Dekstop -> Settings -> Automate:


@amusleh

amusleh
04 Apr 2022, 09:44

Hi,

When you subscribe to bars by using ProtoOASubscribeLiveTrendbarReq you will receive a ProtoOASpotEvent whenever a new bar opens, the OnBar method in automate API is also called whenever a new bar opens.

So If you want to run any kind of logic on bar open you can use the ProtoOASpotEvent.

 


@amusleh

amusleh
04 Apr 2022, 09:41

Hi,

In visual back test mode you can only see a single chart.

You can use an indicator to show another chart data on a separate indicator window if you want to.


@amusleh

amusleh
02 Apr 2022, 11:04

RE: RE:

Mr4x said:

amusleh said:

Hi,

You should never use DateTime.Now or DateTimeOffset.Now in backtest environment, because those two are .NET BCL APIs that uses your system time.

Instead you should use Server.Time and Server.TimeInUtc which will give you the current time of the server is live mode and the current time in backtest environment.

Thank you for your feedback. For this I do want the bot to execute according to my local system time

Hi,

Server.Time gives the current time in your set time zone via TimeZone property of Robot attribute, change that to your local time zone.

As I said using DateTime.Now doesn't make any sense in back test.


@amusleh

amusleh
01 Apr 2022, 11:30

Hi,

Can you please send us the CSV data file that you used with a cBot sample that can reproduce this issue?


@amusleh

amusleh
01 Apr 2022, 11:26

Hi,

Try to change the compiler from your cTrader settings to SDK compiler, the default one is embeded compiler which has limited functionality.

cTrader 4.2 is not released for any broker yet, it's only available as beta on Spotware cTrader beta.


@amusleh

amusleh
01 Apr 2022, 11:24

Hi,

You should never use DateTime.Now or DateTimeOffset.Now in backtest environment, because those two are .NET BCL APIs that uses your system time.

Instead you should use Server.Time and Server.TimeInUtc which will give you the current time of the server is live mode and the current time in backtest environment.


@amusleh

amusleh
31 Mar 2022, 14:22

RE: RE: RE: RE: RE:

ctid1980098 said:

amusleh said:

ctid1980098 said:

Ctrader updated yesterday and this no longer works for some reason. Any thoughts? Trying to get it working. 

If i get it to work. I will post here

 

Hi,

I just tested it on cTrader 4.2 Spotware beta and it works fine, on which version it's not working?

Hi,

Tried on 4.2 beta and couldn't get it to work. However my broker still uses 4.1, so i reinstalled and it is working for now. Will try again later with 4.2 beta. 

Hi,

If there is any error please post, it works fine on 4.2 and 4.1.


@amusleh