Topics
20 Dec 2023, 20:00
 272
 0
29 Jun 2023, 22:22
 535
 6
05 Jun 2023, 18:18
 433
 2
05 Jun 2023, 15:04
 519
 5
Replies

AlexFrei
08 Nov 2023, 13:52 ( Updated at: 09 Nov 2023, 06:30 )

RE: RE: RE: Error CS0103: The name 'Properties' does not exist in the current context

PanagiotisCharalampous said: 

AlexFrei said: 

PanagiotisCharalampous said: 

Hi prlozc,

I think the message is clear, you use an object called Properties that is not defined anywhere.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

Yes, but this code is from your sample and documentation: https://help.ctrader.com/ctrader-automate/references/Controls/Image/

I have the same problem.

How to resolve it  please ?

The code is calling a file from the projects resources. You need to add resources to your project. Read more below

https://learn.microsoft.com/en-us/dotnet/core/extensions/create-resource-files

 

Hello, today I created new Bot, I added image to resource and It doesnt work again. Properties not exists. 

Souluion is easy. I had to add namespace Bot.Properties to using and then referenced image in source without Properties: Source = Resources.Logo

 


@AlexFrei

AlexFrei
03 Nov 2023, 09:48 ( Updated at: 03 Nov 2023, 13:16 )

RE: RE: RE: Error CS0103: The name 'Properties' does not exist in the current context

PanagiotisCharalampous said: 

AlexFrei said: 

PanagiotisCharalampous said: 

Hi prlozc,

I think the message is clear, you use an object called Properties that is not defined anywhere.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

Yes, but this code is from your sample and documentation: https://help.ctrader.com/ctrader-automate/references/Controls/Image/

I have the same problem.

How to resolve it  please ?

The code is calling a file from the projects resources. You need to add resources to your project. Read more below

https://learn.microsoft.com/en-us/dotnet/core/extensions/create-resource-files

 

Thank you for your reply. I had of course created resources /resx file in my project with png image. But it didnt work. So I tried remove all resources and created it again and now it works well and object Properties and Resources (logo included) exist. 

 I have no clue why it havent worked before


@AlexFrei

AlexFrei
02 Nov 2023, 10:09 ( Updated at: 02 Nov 2023, 12:08 )

RE: Error CS0103: The name 'Properties' does not exist in the current context

PanagiotisCharalampous said: 

Hi prlozc,

I think the message is clear, you use an object called Properties that is not defined anywhere.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

Yes, but this code is from your sample and documentation: https://help.ctrader.com/ctrader-automate/references/Controls/Image/

I have the same problem.

How to resolve it  please ?


@AlexFrei

AlexFrei
18 Jul 2023, 19:09 ( Updated at: 18 Jul 2023, 19:12 )

RE:

Spotware said:

Hi DelFonseca,

Thank you for reporting this issue. We managed to reproduce this and we will fix it in an upcoming update.

Best regards,

cTrader Team

Hello, I have very similar problem ! I have Grid control in Chart and Button as child of this Grid. On Button Click event I create next control (child of the same Grid) close to first Button. It worked on 4.7. version. But It doesnt work on 4.8.15 anymore. Button doesnt appear on click

Thank you for solving this issue.

Alex


@AlexFrei

AlexFrei
30 Jun 2023, 12:10

RE: RE: RE:

firemyst said:

AlexFrei said:

 

Hi Firemyst, thank you so much !! I didnt know about History collection. Great. Thanks ! Have a great day

 

No worries. That's what the forums are for :-)

Thank you for having people like you.  Many others usually make me look like an idiot if I ask some basics 


@AlexFrei

AlexFrei
30 Jun 2023, 09:38

RE:

firemyst said:

You can do it in a position closing event method. Rough example below:

 

//In the OnStart method:
Positions.Closed += Positions_Closed;


//In the method itself once the event is defined:
private void Positions_Closed(PositionClosedEventArgs args)
{
     Position p1 = args.Position;
    //do whatever you have to do

    //Now get the historical trade stuff.
    HistoricalTrade ht = History.FindLast(p1.Label, p1.SymbolName, p1.TradeType);
    Print("Position \"{0} {1}\" closed for reason \"{2}\" with {3} profit. Entry Price {4}, Closing Price {5}, StopLoss {6}, ClosingTime {7}", p1.Id, p1.Label, args.Reason, String.Format("{0:$#,###.00}", p1.GrossProfit), p1.EntryPrice, p1.ClosingPrice, p1.StopLoss, ht.ClosingTime);

    //finish off whatever you have to do
}

 

 

Hi Firemyst, thank you so much !! I didnt know about History collection. Great. Thanks ! Have a great day


@AlexFrei