Topics
Replies
firemyst
25 Jan 2023, 06:21
Probably not, because there's no way to know when a new bar is going to start. A new bar forms on the first tick after the previous bar closes. It could take half a second, or 10 seconds (depending on the time of day and symbol) on when that next tick will come in to cause a new bar to open up.
@firemyst
firemyst
25 Jan 2023, 06:18
RE:
jennifer1978bgf said:
How to apply multiple currencies by one cBot?
I have tried the code below, even different currencies get opened, the price is not correct.
Can someone help?
[Parameter("Vol", DefaultValue = 10000)]
public int Vol { get; set; }
protected override void OnStart()
{
Symbol symbol_1 = MarketData.GetSymbol("USDJPY");
Symbol symbol_2 = MarketData.GetSymbol("EURUSD");
Symbol symbol_3 = MarketData.GetSymbol("GBPUSD");
var result =
PlaceLimitOrder(TradeType.Buy, symbol_1, Vol, Symbol.Ask - 15 * Symbol.PipSize, "BU", 30, 15);
PlaceLimitOrder(TradeType.Buy, symbol_2, Vol, Symbol.Ask - 15 * Symbol.PipSize, "BE", 30, 15);
PlaceLimitOrder(TradeType.Buy, symbol_3, Vol, Symbol.Ask - 15 * Symbol.PipSize, "BG", 30, 15);
if (!result.IsSuccessful) Print("Error: ", result.Error);
Stop();
}
}
}
one of your issues is for each of those, you're using the chart's current symbol to get the ask and pipsize, not the currency you want.
Symbol.Ask gets the charts current symbol's asking price.
If you want the asking price of USDJPY for example, with your code you have to use symbol_1.Ask and symbol_1.PipSize
@firemyst
firemyst
25 Jan 2023, 06:10
You seriously need to be more specific in what you are asking for.
% changes with what?
% Difference in an indicator value?
% Difference in current close price vs last close price?
% difference in current price vs yesterday's market close price?
% difference in bar's open value vs the last bar's open value?
Something else?
@firemyst
firemyst
16 Jan 2023, 08:23
Since you haven't posted all your code, will the while loop ever end? That is, what is "firstDt" set to and will that ever evaluate to true? Or is it just going to continuously load tick data back from the beginning of time because it'll never evaluate to true?
That would explain why it never stops loading and your CPU is at full capacity.
@firemyst
firemyst
12 Jan 2023, 02:50
RE:
Xammo said:
Hi Firemyst
There is another thread about this that I first reported back in September (it started long before that though) and isn't related to renko charts (I don't/have never used them)
Fair enough you didn't see it as when you search the forums here for 'Losing Automate Display' you get nothing but if you put the same search term including cTrader into google it's the first hit and is the only way I can keep finding it again! So basically the search function within these forums does not work properly!
Anyway at least you have been getting replies from Spotware they seem to be totally ignoring the other thread and were saying they couldn't replicate the issue but there are more and more clients having the issue - it is VERY frustrating and disconcerting to trade on a platform that blacks out!
HI @Xammo:
This time around I sent @Spotware the tech info from within cTrader itself, clicking on the "?" icon on the bottom left for "help center", and selecting "report technical issue".
Guess time will tell if they actually manage to find/replicate the issue. At times I feel like the employees at Spotware don't use their own products as to me, setting up cTrader on a VPS and letting it run bots on its own overnight is basic functionality that could be tested and would catch this issue.
@firemyst
firemyst
09 Jan 2023, 03:50
( Updated at: 21 Dec 2023, 09:23 )
RE:
opusensemble said:
How can convert my script that writes in the filesystem, to support NET 6.0 framework?
Since the change to .NET 6.0 I'm getting the following error:
Error CS0619: 'AccessRights.FileSystem' is obsolete: 'The access right is not supported in .NET 6.0 and higher'
Thank you.
By giving the bot "AccessRights.FullAccess" ? Start with the most permissions and work your way backwards :-)
@firemyst
firemyst
09 Jan 2023, 03:47
RE:
ashish.sah.np said:
I'm trying to multiply the Volume for next trade by dividing the factor obtained by ratio of last net loss and a user defined value. But it doesn't seem to increase the volume it just uses the _mult value as 1 always. Can someone provide me the alternative code or any solution.
[Parameter("Average Trade Price (amt)", Group = "Volume", DefaultValue = 2, MinValue = 0.01, Step = 0.01)] public double Invest {get;set;} [Parameter("Quantity (Lots)", Group = "Volume", DefaultValue = 0.01, MinValue = 0.01, Step = 0.01)] public double Quantity {get;set;} private double _mult=1; protected override void OnStart() { Positions.Closed += OnPositionsClosed; } private void OnPositionsClosed(PositionClosedEventArgs args) { var position = args.Position; if (position.NetProfit < 0) { _mult = Math.Abs((position.NetProfit)/Invest); } else { _mult = 1; } } protected override void OnTick() { var volumeInUnits = (Symbol.QuantityToVolumeInUnits(Math.Round((Quantity*_mult), 2, MidpointRounding.AwayFromZero))); ExecuteMarketOrder(TradeType.Buy, SymbolName, volumeInUnits, "Long",SL,TP); }
First question: is
if (position.NetProfit < 0)
ever true?
Eg, have any of the positions ever had a NetProfit in the code? If so, how do you know? I don't see any logging, and don't know if you've run it with VS to have a breakpoint there to see.
@firemyst
firemyst
09 Jan 2023, 03:44
RE:
j.crowe said:
Hi,
I have looked all over the documentation, so I am not sure this is possible, but is there a way to get news events into a bot? Basically if there is a high impacting news release due I want to shut my trades down and not trade until it is over to protect my account. There is a plugin I can buy from ClickAlgo but I dont want to have to keep loading the data in every 3 months. I just want the bot to run and be able to get the news events coming up with the impact they will have on the price.
Cheers,
Jay
SInce they are now integrated with FXStreet, I would see if FXStreet has any API's you can access:
@firemyst
firemyst
09 Jan 2023, 03:35
RE:
opusensemble said:
I've noticed that the cBots I had for .NET 4.x, no longer build on NET 6.0.
Is there any estimate of how long will the 4.x framework be supported?
If it's going to be discontinued, can Spotware provide a date, similar to what Microsoft does for Windows OS?
Thank you.
Since Microsoft typically supports any .Net version that's included with Windows OS, and right now .Net 4.8 is provided with Windows 11, so it in itself will be support through WIndows 11 life time.
Given that MS will be supporting it, hopefully Spotware will as well.
@firemyst
firemyst
31 Jan 2023, 07:49 ( Updated at: 21 Dec 2023, 09:23 )
An update, it has happened again. When the "Take Profit" line in cTrader was hit, it only closed 1.1 of the 1.2 lots in the position, leaving 0.1 lots open.
As of this posting, my broker is still investigating the first incident I reported above.
@firemyst