Why don't you just set the take profit from the indicator?
Best regards,
Panagiotis
Because Indicators can not open, close or modify positions/orders .. And I need some stuff to communicate in the indicator with a cBot then.
I need a way to modify positions (TP) and close positions witch is not possible with Indicator. I would like to have an Indicator on each symbol I Trade and use it's logic and only have 1 cBot open in the Automate section.
So each indicator can communicate for the actions it can't do like modifying or closing positions when neccessary.
TommyFFX
Since version 5.0 they can, so make your life easier and just trade through the indicator :)
Thank you for your feedback. I was using previous version of broker. At first it didn't work.. Now I figured out that an Indicator that is not created in version 5.0 doesn't work. Then I created a new Indicator in 5.0 and it worked. So when having old Indicators you need to paste it into new ones in 5.0 if you want it to work .. But it would be usefull to know how to communicate with a cBot. I'm developing management software. So like MagicKeys for instance. They have a bot and indicator.. Because I'm facing the next obstacle when timeframe is changing I lose my objects or globals, while a cBot is not.. MagicKeys has somewhere a method to communicate cause they have the indicator and the cbot..
Best Regards TommyFFX
There are several ways to achieve communication between a cBot and an Indicator e.g. you can use files or named pipes.
I'm not clear where we're supposed to report bugs. If this is the wrong spot, please advise.
In this release, I'm seeing a repeated option in the Backtesting Settings → Data dropdown dialogue.
Hi there,
The one option is always m1 and the other one adjusts based on the selected timeframe. If you select m1, then these two options coincide. I don't think this is a big issue to be honest.
Is your backtester equivalent to cTrader i.e. handles all necessary calculations, like margin calculation, conversions between currencies etc. If it is not, then the comparison is not really valid.
The wording doesn't make it explicit that you will be accessing an incomplete new bar, rather than the newly completed old bar with all the OHLC data. In every other platform I've used (quite a few now) OnBar() passes or signals the interesting old bar rather than the uninteresting new bar.
The next point of confusion is the dropdown from the cog menu item, which clearly states that you are only getting open prices. While in fact as you have just explained you can access all 4 prices. (And there's also the bug where it shows the same option twice). Surely this is a UX glitch?
So unless the user takes a deep dig through the API docs, the procedure for accessing this vital data is both unintuitive (in the sense that other platforms do it differently) and well hidden (in the sense that the tutorial doesn't explain it and the cog dropdown text is misleading).
Maybe I'm unusually dim, but I'm surprised that more people haven't run into this roadblock. It would be helpful if the tutorial and the dropdown were more user-friendly…
Geoff
Hi Geoff,
Thanks for your suggestions. Here are my responses to some of the points raised
The next point of confusion is the dropdown from the cog menu item, which clearly states that you are only getting open prices.
You get all historical OHLC prices but the execution is based on the open prices only
And there's also the bug where it shows the same option twice
It's not really a bug. In general, these are two different options, the one is to use the selected timeframe's bars, the other is to use m1 bars (even if you are on h1). When you choose m1 these timeframes coincide. It looks weird in this specific case but I not think it's a real problem.
Why don't you just set the take profit from the indicator?
Best regards,
Panagiotis
Because Indicators can not open, close or modify positions/orders .. And I need some stuff to communicate in the indicator with a cBot then.
I need a way to modify positions (TP) and close positions witch is not possible with Indicator. I would like to have an Indicator on each symbol I Trade and use it's logic and only have 1 cBot open in the Automate section.
So each indicator can communicate for the actions it can't do like modifying or closing positions when neccessary.
TommyFFX
Since version 5.0 they can, so make your life easier and just trade through the indicator :)
It's hard to answer such vague questions if we cannot see what you are actually doing. Logical errors do not generate any log messages as they are not considered problems by the system. The computer executes what you have instructed it to do, even if this is different from what you expect it to do or what you think it does.
This issue has been fixed, it's been a while. I cannot reproduce it. Make sure you download historical data when you backtest.
Hi Panagiotis,
The values I get for the account margin are still not matching while backtesting the code above. Are you backtesting an index? Probably not.
I selected the historical data, as suggested. However, the account and symbol currency is the same (USD) and still I am getting different results when selecting/unselecting this option. Why?
I checked this with both Varianse and Pepperstone (using historial data). Below is the backtest output with Varianse.
Hi ncel01,
Yes I do
However, the account and symbol currency is the same (USD) and still I am getting different results when selecting/unselecting this option. Why?
The functionality should work correctly when the option is checked. We are checking why it is not working when unselected and the quote currency matches the account currency. In the meanwhile, keep it checked.
Panagiotis,
The functionality should work correctly when the option is checked.
How come, when my screenshot clearly shows that Account.Margin is returning 0 even with an open position? Did you check this with some other accounts/brokers (apart from Spotware)? If not, can you please double-check this?
Thanks.
Hi ncel01,
It works fine on Variance as well.
Please send a full screenshot like the above, so that we can understand what you are doing
Hi Panagiotis,
Thanks for looking into this again. I meant an account with a different broker, not exactly the broker version of cTrader. So far, I found that Account.Margin is not correct in the following cases (at least):
Example 1: Any live account (tested with Pepperstone and TopFX)
Example 2: New demo accounts (without trading activity) where Symbol Leverage > Account Leverage (tested with Varianse)
I've added a screenshot for each of these examples (see below). I am running the cBot shared above (historical data is checked). Note that, regardless of what leverage is considered (symbol/account), the calculated account margin does not match Account.Margin in any of the cases shown.
Something is clearly not going as expected here. The results show that there is not a unique/consistent calculation for Account.Margin, no matter the situation.
Example 1:
Example 2:
Something else I noticed in the meantime that I also don't understand: Positions.Count is returning 0 while called inside Positions_Opened(). See below.
Hi ncel01,
As far as I can see, in all the cases with discrepancy, your account currency is different to the symbol currency, however your calculations do not include any conversion logic. The API's property converts the margin to the account's currency value. The XTE issue seems a separate issue, can you report it in a different thread?
If you are calling LastBar in OnBar() then you will get the same prices, since the method is called on bar opening. Try OnBarClosed() instead and you should get the OHLC values.
PanagiotisCharalampous
23 Aug 2024, 06:55
RE: RE: RE: RE: How to make cBot setting Take Profit when pushing button in Indicator
TommyFFX said:
There are several ways to achieve communication between a cBot and an Indicator e.g. you can use files or named pipes.
Best regards,
Panagiotis
@PanagiotisCharalampous