problem with: OnPositionsClosed
problem with: OnPositionsClosed
25 Jul 2020, 22:32
I'm using the OnPositionsClosed function
private void OnPositionsClosed(PositionClosedEventArgs args)
{
var position = args.Position;
var position1 = Positions.Find("MyLabel");
var position2 = Positions.Find("MyLabel");
ecc...
}
the bot does not recognize the position1 and position2 variables.
var position = args.Position: does this function cause all closed positions whatever their label label to be marked with "position"?
I do not understand why.
Replies
luca.tocchi
27 Jul 2020, 11:15
RE:
PanagiotisCharalampous said:
Hi Luca,
What do you mean when you say?
the bot does not recognize the position1 and position2 variables.
You need to use a more precise language.
Best Regards,
Panagiotis
what I want to say:
private void OnPositionsClosed(PositionClosedEventArgs args)
{
var position = args.Position;
}
the function considers all positions that close regardless of the label
I need to tell him: if position 1 (var position1 = Positions.Find ("MyLabel1") is closed do this ..
so also for other positions with different labels,
but I can't ... because it considers all positions closed regardless of the label
@luca.tocchi
PanagiotisCharalampous
27 Jul 2020, 11:23
Hi Luca,
Try this
if(args.Position.Label == "MyLabel1")
{
// Do something...
}
You need to use a more precise language.
Best Regards,
Panagiotis
@PanagiotisCharalampous
luca.tocchi
27 Jul 2020, 11:26
RE:
PanagiotisCharalampous said:
Hi Luca,
Try this
if(args.Position.Label == "MyLabel1") { // Do something... }
You need to use a more precise language.
Best Regards,
Panagiotis
awesome! thanks
@luca.tocchi
PanagiotisCharalampous
27 Jul 2020, 08:21
Hi Luca,
What do you mean when you say?
You need to use a more precise language.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous