Topics
Forum Topics not found
Replies
amusleh
17 Nov 2021, 07:57
Hi,
Did you checked the API references example: cAlgo API Reference - IndicatorDataSeries Interface (ctrader.com)
You have to store your calculation result inside an IndicatorDataSeries, then you can use that data series on your cBots.
@amusleh
amusleh
17 Nov 2021, 07:55
Hi,
I didn't understood your issue, but If you are not using multiple symbols data for taking trading decision then there is no need to use multiple symbols on your cBot.
Just create a new instance of your cBot for each symbol you want to trade.
That way you keep your cBot code simple.
@amusleh
amusleh
17 Nov 2021, 07:46
Hi,
Each symbol has a minimum and maximum volume properties that you can use for checking the symbol minimum and maximum allowed trading volume.
The properties are in in volume units not lots, you can use the symbol VolumeInUnitsToQuantity method to change the volume units to lots.
@amusleh
amusleh
05 Nov 2021, 07:35
Hi,
You can use history to sum the net profit of all your closed positions (trades):
var netProfit = History.Sum(trade => trade.NetProfit);
To get net profit of all your open positions you can use Positions:
var netProfit = Positions.Sum(position => position.NetProfit);
@amusleh
amusleh
04 Nov 2021, 08:03
( Updated at: 04 Nov 2021, 08:04 )
Hi,
Your code has several issues, please fix the issues first then we will see if there is any scaling issue or not.
You are using the baseIndex for Bars, the baseIndex is for other time frame, you can't use it for Bars which is from current chart time frame.
For setting indicator outputs you are again using baseIndex, which is not correct, you have to use index for setting outputs not baseIndex.
Use the baseIndex only for getting the other time frame data, not for outputs of current chart time frame Bars.
@amusleh
amusleh
04 Nov 2021, 07:58
RE: RE: RE: RE:
yuval.ein said:
A. What does the Stop method does?
B. If I have several instances of the same cBot and one of them calls the Stop, does it effect the other instances?
Thanks
Hi,
No, it doesn't effect other instances, if you call Stop on a cBot it will only stop the instance that called the method not the other ones.
@amusleh
amusleh
04 Nov 2021, 07:57
Hi,
C# is a different programming language, its a managed programming language with garbage collection that runs on top of .NET runtime.
You can call unmanaged C++ DLL functions on C#, check this tutorial please: How to call a c++ dll in C#.net code - CodeProject
@amusleh
amusleh
03 Nov 2021, 15:25
RE: RE:
swapd0 said:
PanagiotisCharalampous said:
Hi swapd0,
Can you check if you can reproduce this problem using FIX API Sample? If you can connect using the sample, then compare the messages to find what is different.
Best Regards,
Panagiotis
I can't test it with FIX API Sample because I have a Mac.
Hi,
You can use these samples on Mac: spotware/quickfixnsamples.net: .NET Samples for QuickFIXn library and Spotware FIX API (github.com)
@amusleh
amusleh
03 Nov 2021, 08:26
Hi,
I tested your code and something is wrong on it, because some of the outputs doesn't continue to the last bar.
Instead of using multiple time frames on a single indicator which makes debugging much harder for you I recommend you to use only one single time frame.
Develop an Ichimoku indicator that get just one time frame and then you can use three instance of that indicator for multiple time frames.
Regarding scaling, Ichimoku lines mostly follow the price and you should not have any scaling issue, the scaling issue occurs if your indicator lines are very far away from price series.
@amusleh
amusleh
03 Nov 2021, 08:18
Hi,
Field 108 is for heart beat interval and its required, here is a valid logon message that I just tested:
8=FIX.4.4|9=195|35=A|49=demo.ctrader.***|34=1|56=cServer|57=TRADE|50=TRADE|52=20211103-06:04:54.485|98=0|108=30|141=Y|553=***|554=***|10=026|
Are you sure you are connected to Trade end point? please check the host and port, maybe you are using Quotes port instead of Trade port.
@amusleh
amusleh
03 Nov 2021, 08:00
Hi,
OpenAPI only gives you time based bars, not Renko/Tick/Range bars data.
You can calculate the other bar types by using Tick data, you can get the tick data from Open API.
It's not on our roadmap to add the other bar types but you can post a suggestion and we might consider adding it on next versions of API.
@amusleh
amusleh
02 Nov 2021, 08:14
RE: RE:
SYUNHUA said:
amusleh said:
This sample might help you:
using cAlgo.API; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class PauseEvents : Robot { private bool _isPaused; protected override void OnStart() { Chart.MouseDown += Chart_MouseDown; } private void Chart_MouseDown(ChartMouseEventArgs obj) { if (obj.ShiftKey) { _isPaused = true; Print("Events paused"); } else if (obj.CtrlKey) { _isPaused = false; Print("Events running"); } } protected override void OnTick() { if (_isPaused) return; } protected override void OnBar() { if (_isPaused) return; } } }
If you press shift + click then it will pause the OnTick/Bar, and if you press Ctrl + Click then it will allow the code on OnTick/Bar after is pause check to execute.
it is not working, just printed log, I have deleted onBar or Ontick to test. what else do I need to do
Hi,
The above sample only disables OnTick/OnBar, it doesn't pause back tester.
@amusleh
amusleh
17 Nov 2021, 08:04
Hi,
Do you mean Commodity Channel Index? if that's what you meant by CCI then this indicator is available as a built-in indicator of cTrader and you can use it on your cBot like any other indicator.
Check here for an example: cAlgo API Reference - CommodityChannelIndex Interface (ctrader.com)
@amusleh