Topics
Forum Topics not found
Replies
amusleh
05 Apr 2022, 09:36
Hi,
You can use cMAM: cMAM - Copy cTrader Trades - AlgoDeveloper
@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, 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
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: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
amusleh
05 Apr 2022, 09:44
RE: RE: RE: Code to make this work?
william@hallsdesign.co.uk said:
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