Can we have the cBot that reproduces this problem?
Best regards,
Panagiotis
On a separate issue, I'm not receiving email notifications when someone responds to a post in the forums. Are they working?
The issue reported above happened again to me today. AGain the button won't click, I can't stop it. The only way for me to get out of this is to kill cTrader and restart.
When I do that, I do know the “OnStop” even doesn't happen or register, because in my code when a bot instance stops, I have it write information to a text file. All the forex pairs (such as NZDUSD below) don't write anything out when this happens. So whatever terminates the process doesn't cause the “OnStop” even to fire.
I can't figure out exactly how to reproduce it, so am not sending through the full bot code. I do know it happens when I have 26 bot instances running under one instance of cTrader on a VPS using 4GB of memory making all sorts of trades and managing them. Maybe it gets hung when too many ticks come through and it can't handle them? Kind of like when debugging in Visual Studio and if we wait too long it kills the process to safeguard data.
I'm trying to figure out code to send you that easily reproduces this behaviour all the time.
Hi firemyst,
If you want to receive notifications for responses, make sure you subscribe to the thread
Best regards,
Panagiotis
I started this post, thus I'm automatically subscribed. I should have received your response, but nothing. I didn't know until I was browsing today. That's why I was asking. I know about the subscribe feature.
However, I received a notification about your most recent response, so that tells me 1) either you somehow responded differently over the weekend (being an admin and all) that cause me to not receive anything or 2) the service was down for some reason.
Can we have the cBot that reproduces this problem?
Best regards,
Panagiotis
On a separate issue, I'm not receiving email notifications when someone responds to a post in the forums. Are they working?
The issue reported above happened again to me today. AGain the button won't click, I can't stop it. The only way for me to get out of this is to kill cTrader and restart.
When I do that, I do know the “OnStop” even doesn't happen or register, because in my code when a bot instance stops, I have it write information to a text file. All the forex pairs (such as NZDUSD below) don't write anything out when this happens. So whatever terminates the process doesn't cause the “OnStop” even to fire.
I can't figure out exactly how to reproduce it, so am not sending through the full bot code. I do know it happens when I have 26 bot instances running under one instance of cTrader on a VPS using 4GB of memory making all sorts of trades and managing them. Maybe it gets hung when too many ticks come through and it can't handle them? Kind of like when debugging in Visual Studio and if we wait too long it kills the process to safeguard data.
I'm trying to figure out code to send you that easily reproduces this behaviour all the time.
Spotware won't look here for suggestions because this is for technical support.
However, you could accomplish what you want now in a round-about way. Just build your own structures and put the relevant symbol in each structure.
For instance, in C# code, create a HashTable with all the Indices you want to trade, or could trade. Call the HashTable AssetCategory_Indices; similarly, do one for all the forex pairs you might trade.
Then you can check which asset category the current symbol is in by checking each of your HashTables.
You can do it, but it might not be 100% accurate on when it happens when calculating previous candles.
This is because on the higher timeframe, it'll be seen as crossing at the opening time of that bar. So like 1pm, 2pm, 3pm,. etc.
So on your 15M chart, you can:
have it shown on the 4 15-minute bars that make up the hour
or it'll probably just be shown on the first 15-minute bar of the corresponding hour. That is, if it crossed at 1:20pm, yesterday, when the indicator opens and calculates previous bars, it only goes by closing prices, not actual ticks, so it'll show as closing at 1pm and not the 15-minute bar that represents 1:20pm.
OTherwise, for example code, check out Spotware's online documentation:
How about instead of making users having to show/hide the indicator tiles, Spotware change the Indicator Tiles Z-index values to be less than the SL/TP lines so when a user moves their mouse pointer to the top left, the SL/TP are the first things the mouse will highlight and grab?
As explained in your other thread, this is an issue of your cBot, you need to handle this situation inside your cBot code
I saw that other people had the exact same problem, and the same issue happens even if you use an algo bot ctrader generated bot. I don't think it's a “me” problem, there's even a post on quora about someone who had the exact same issue and didn't find any answer here or in the ctrader database. Looks like it's something like a latency issue with ctrader while using bots, if there's a command to input a stop loss and the ctrader doesn't compute that command and proceeds with the order it doesn't look like something an external code should fix.
As @PanagiotisCharalampous explained, you need to explain exactly how to reproduce the issue and/or provide code that does.
Otherwise, you need to put checks in your code, which I'm guessing you haven't since you haven't posted any code?
This simple example checks the spread before an order is placed (you need to make sure it's smaller than the distance to your SL as well), and also checks that after an order is successful, if there's a stop loss:
if (Symbol.Spread < myMaxSpreadPipsAllowedToPlaceAnOrder)
{
//Spread is less than our threshold, so you can place your order now
TradeResult r = ExecuteMarketOrder(TradeType.Buy, s.Name, InitialPositionSize, _positionLabel, yourSL, yourTP, commentString, false);
if (r.IsSuccessful)
{
//Get your new position and store in in a variable. In this case, I've named it "_p_".
//Then check to make sure there's a stop loss
if (_p.StopLoss.GetValueOrDefault() == 0)
{
Print("WARNING! There is no stoploss! Why?! \"{0} {1}\".", _p.Id, _p.Label);
//close your position, or try implementing a new stop loss, or whatever.
}
}
}
else
{
Print("WARNING! Spread {0} is too big! Not placing order", Symbol.Spread);
}
That should help get you going in the right direction.
Well, you haven't shown us anything you've done, so I'm not sure how much help you're expecting from people.
Note that you'll probably have to reinitialize the indicator on each onBar event for the indicator to take on the new values and historically calculate them. While it may not matter too much on a long time frame or higher non-time frame based chart (like renko 20 vs renko 5), it could end up being CPU intensive if done frequently like for every bar on a 1-minute chart.
First of all, price is the BID line; your SL might have been hit by the ASK line. Do you have both shown on the chart?
Second, if you want money back, you have to talk to your broker.
What's the solution for it?
Solution for what? If you want the ASK line shown so you can see when it hits your stop loss, have it displayed on the chart.
If you want your money back, as I said earlier, you have to try and speak to your broker. But I doubt they'll give you your money back if your order was taken out legitimately (eg, either by BID or ASK line)
The highest index should have the latest value. The indexes in the series also coincide with the bar numbers on the chart.
You can test this yourself by reading the first value, the last value, and comparing against values on the chart.
In layman's terms, if the latest value was kept at index 0, cTrader would have to constantly rewrite the DataSeries updating all the indexes, which is very inefficient. Whereas, just tacking on the last value to the DataSeries List object is the most efficient way - the entirety of the list doesn't have to be constantly updated with each new bar.
This website uses cookies to enhance site navigation, analyze site usage, and assist in our marketing efforts. By clicking “Accept All” you are providing your consent to our use of all cookies. Alternatively, please provide your choice by pressing “Customize Cookies”. For more information, please read our Privacy policy
firemyst
11 Aug 2024, 11:02 ( Updated at: 11 Aug 2024, 15:29 )
Your bot probably won't work as you want because if you read this page:
https://help.ctrader.com/ctrader-algo/synchronisation/requirements-for-cbots/#compile-time-references
http requests aren't sent when bots run in the cloud.
@firemyst