Topics
Replies
RezaNoorimotlagh
15 Oct 2018, 15:04
RE: choose specific Symbol or Symbols
Dear Panagiotis,
I currently use version 3.0 cTrader. After running this code, The cTrader genarates the following error.
Code:
foreach (var position in Positions.@where(x => x.SymbolCode == "EURUSD"))
Error:
Error CS1061: 'cAlgo.API.Positions' does not contain a definition for 'where' and no extension method 'where' accepting a first argument of type 'cAlgo.API.Positions' could be found (are you missing a using directive or an assembly reference?)
Thanks,
Reza
@RezaNoorimotlagh
RezaNoorimotlagh
13 Oct 2018, 14:25
RE:
Dear Panagiotis,
A Good Solution.
Regards,
Reza
Panagiotis Charalampous said:
Hi noorimotlagh.reza,
Try this
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class CV2 : Robot { protected override void OnTick() { foreach (var position in Positions) { Print("SL {0}", position.StopLoss); Print("The current symbol has pip size of: {0}", MarketData.GetSymbol(position.SymbolCode).PipSize); } } } }Best Regards,
Panagiotis
@RezaNoorimotlagh
RezaNoorimotlagh
12 Oct 2018, 19:35
RE:
Panagiotis Charalampous said:
Hi noorimotlagh.reza,
This method is available only in Spotware Beta 3.3.
Best Regards,
Panagiotis
Dear Panagiotis,
Thanks for your help and support.
Regards,
Reza
@RezaNoorimotlagh
RezaNoorimotlagh
12 Oct 2018, 12:48
( Updated at: 21 Dec 2023, 09:20 )
RE:
Panagiotis Charalampous said:
Hi noorimotlagh.reza,
Thanks for posting in our forum. Which version of cTrader do you use? Can you post your cBot code so that we can fix it?
Best Regards,
Panagiotis
Hi Panagiotis,
I use from version 3.0 of cTrader. You can see in below figures that "ModifyStopLossPips" isn't exist in my cTrader reference.
Actually, i need to this method for several code, i don't want to use from this method " double? stopLoss = Symbol.Ask- 10*Symbol.PipSize".
@RezaNoorimotlagh
RezaNoorimotlagh
15 Oct 2018, 20:21
Hi Panagiotis,
The @ be add to the code after saving by cTrader (I don't know why?!!?). You can see in below codes that are befor and after saving: After the build the code, cTrader genarates this error; (Error CS1061: 'cAlgo.API.Positions' does not contain a definition for 'where' and no extension method 'where' accepting a first argument of type 'cAlgo.API.Positions' could be found (are you missing a using directive or an assembly reference?)
Befor Saveing:
After Saving:
Regards,
Reza
@RezaNoorimotlagh