Topics
Replies
ctid+customer-395444
04 Dec 2023, 03:43
( Updated at: 04 Dec 2023, 08:32 )
Why don't you just “nullify” your indicator object, and then recreate it?
You have to create and get the indicator data via code when you first start your cBot, so just do it again if you know there's a change.
@ctid+customer-395444
ctid+customer-395444
03 Dec 2023, 11:39
( Updated at: 04 Dec 2023, 08:32 )
Post it in the correct forum and it might actually be acted upon:
https://ctrader.com/forum/suggestions
@ctid+customer-395444
ctid+customer-395444
03 Dec 2023, 11:38
( Updated at: 04 Dec 2023, 08:32 )
DOn't know they'd do that since you haven't even taken the time to post it in the right forum:
https://ctrader.com/forum/suggestions
@ctid+customer-395444
ctid+customer-395444
03 Dec 2023, 11:36
( Updated at: 04 Dec 2023, 08:32 )
Legal and Regulations ramifications.
For starters, because Spotware could then be liable if something unexpected happens and/or there's malicious code.
That's why code has to be posted so everyone can see what it does and Spotware is also covered in that respect because you're made aware of what the bot/indicator does.
@ctid+customer-395444
ctid+customer-395444
03 Dec 2023, 11:28
( Updated at: 04 Dec 2023, 08:32 )
_
First of all, you'd have to register an event that the chart has been updated:
Chart.ObjectsUpdated += botHorizontalLineUpdated;
Define the method and do what you need:
private void botHorizontalLineUpdated(ChartObjectsUpdatedEventArgs args)
{
//these lines are known as small chart horizontal lines
if (args.ChartObjects[0].GetType().Name == "SmallChartHorizontalLine")
{
//Get your line
ChartHorizontalLine obj = (ChartHorizontalLine)args.Chart.FindObject(TheNameOfYourLine);
//Do what you need to from here
}
}
@ctid+customer-395444
ctid+customer-395444
03 Dec 2023, 10:22
( Updated at: 21 Dec 2023, 09:23 )
RE: How to reference indicator without it source code
PanagiotisCharalampous said:
Hi there,
It's not possible to reference an indicator that does not come with source code.
Best regards,
Panagiotis
I'm confused, because I do. I build all my custom libraries and Indicators without including source code, and reference them in my VS cBot projects.
Example:

@ctid+customer-395444
ctid+customer-395444
03 Dec 2023, 10:18
( Updated at: 04 Dec 2023, 08:32 )
Use the HIstoricalTrade object
You could look at the example Spotware provided:
https://help.ctrader.com/ctrader-automate/references/Trading/History/HistoricalTrade/#examples
private void Positions_Closed(PositionClosedEventArgs args)
{
//Only run this method if it's this instance that closed.
Position p1 = args.Position;
if (p1.SymbolName == Symbol.Name && p1.Label == _positionLabel)
{
HistoricalTrade ht = History.FindLast(p1.Label, p1.SymbolName, p1.TradeType);
if (ht != null)
{
//DO whatever if there's historical information
double cp = ht.ClosingPrice;
Print("CLosing Price: {0}", cp);
}
}
}
@ctid+customer-395444
ctid+customer-395444
26 Nov 2023, 10:02
( Updated at: 26 Nov 2023, 11:07 )
RE: RE: Same here! I've noticed too
PanagiotisCharalampous said:
firemyst said:
And have posted about it previously, but nobody from @Spotware has responded nor addressed the issue:
https://ctrader.com/forum/calgo-support/41630
AFAIK this has been fixed. Do you still experience this?
I didn't know this was fixed. I will have a look next chance I get as I haven't bothered to check since reporting the issue since it didn't seem to be acknowledged.
I'm sure you know by now I'm not shy on raising issues, assume no news is good news. :-)
@ctid+customer-395444
ctid+customer-395444
25 Nov 2023, 09:30
( Updated at: 26 Nov 2023, 07:27 )
__
You have to code it yourself to do the calculation if you don't want to use the chart tool to manually show the distance.
@ctid+customer-395444
ctid+customer-395444
25 Nov 2023, 09:27
( Updated at: 26 Nov 2023, 07:27 )
Same here! I've noticed too
And have posted about it previously, but nobody from @Spotware has responded nor addressed the issue:
https://ctrader.com/forum/calgo-support/41630
@ctid+customer-395444
ctid+customer-395444
25 Nov 2023, 09:24
__
Can you post example code and example output that demonstrates your issue?
@ctid+customer-395444
ctid+customer-395444
25 Nov 2023, 09:24
_
Can you post example code and example output that demonstrates your issue?
@ctid+customer-395444
ctid+customer-395444
21 Nov 2023, 01:30
Positions.FindAll(yourPosition.yourLabel, Symbol.Name)
You need to give each of your positions a unique label when creating them.
Then, when you start your bot, check for them if you know there's open positions:
Positions.FindAll(yourPosition.yourLabel, Symbol.Name)
@ctid+customer-395444
ctid+customer-395444
10 Nov 2023, 05:40
( Updated at: 10 Nov 2023, 06:26 )
RE: RE: CheckBox alwyas clicked
eynt said:
Thank you.
It does work, however, I have another problem. I changed the code so it would change the indicator's parameter which is called LOAD_INDICATOR. However, although the print says its value is changed, when I go to the object manager to see the indicator's parameter value, over there it's not changed.
[Parameter(DefaultValue = false)] public bool LOAD_INDICATOR { get; set; }private void CheckBox_Changed(CheckBoxEventArgs e) { Print("CheckBox_Changed 1"); LOAD_INDICATOR = (bool)e.CheckBox.IsChecked; Print("LOAD_INDICATOR= " + LOAD_INDICATOR); }
Looks to me like your cast is wrong.
You appear to be converting “e” to a bool, which I'm sure isn't what you want to do. :-)
@ctid+customer-395444
ctid+customer-395444
10 Nov 2023, 01:21
( Updated at: 10 Nov 2023, 06:26 )
Try contacting @PanagiotisCharalampous
@ctid+customer-395444
ctid+customer-395444
10 Nov 2023, 01:15
You haven't added any event handlers to your checkbox.
You also need to add the checkbox to a canvas, and then add the canvas to the chart.
checkBox.Checked += CheckBox_Checked;
checkBox.Unchecked += CheckBox_Unchecked;
Canvas checkboxCanvas = new Canvas();
checkboxCanvas.AddChild(checkBox);
Chart.AddControl(checkboxCanvas);
@ctid+customer-395444
ctid+customer-395444
31 Oct 2023, 04:03
RE: RE: Bug in History/HistoricalTrade
VEI5S6C4OUNT0 said:
firemyst said:
Have you written anything to the logs or confirmed that the HIST object actually has data and isn't null?
var HIST = History.OrderByDescending ( trade => trade.ClosingTime ) .Take ( 1 ) ;
Yes I tried adding an ExecuteMarketOrder (…….. as part of OnStart and still no trades after that one , it just does nothing.
UPdate the entirety of your code with a Print statement after every conditional check to see where it gets to.
Unless you're using Visual studio and can debug?
@ctid+customer-395444
ctid+customer-395444
27 Oct 2023, 03:26
Have you written anything to the logs or confirmed that the HIST object actually has data and isn't null?
var HIST = History.OrderByDescending ( trade => trade.ClosingTime ) .Take ( 1 ) ;
@ctid+customer-395444
ctid+customer-395444
04 Dec 2023, 03:47 ( Updated at: 04 Dec 2023, 08:32 )
RE: RE: cBots frequently freeze during trading.
eamaster01 said:
You also need to post your issues in the appropriate forum, not the “Suggestions” forum. That's like half your problem to start with:
https://ctrader.com/forum/calgo-support
@ctid+customer-395444