
Topics
Replies
PanagiotisCharalampous
07 Sep 2018, 10:24
Hi alidarvish64@yahoo.com,
It is not clear to me what is the problem
- Was the NoMoney issue solved?
- What do you expect from the cBot to do? In order to help you, I need to know what is the cBot supposed to do and what it does instead.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
07 Sep 2018, 10:18
Hi cerradus@gmail.com,
Thanks for posting in our forum. Your conditions for checking the distance are wrong. If you want to check the distance between entry price and current price, you should use something like the below
(Symbol.Bid - posi.EntryPrice) / Symbol.PipSize > Distance
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
07 Sep 2018, 10:01
Hi Waxy,
I agree that this is helpful and we will try to implement a similar reporting of cTrader products release notes soon.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
07 Sep 2018, 09:50
Hi swingfish,
You can easily calculate this information. For example
Positions.Average(x => x.Pips);
Note that you need to add a reference to System.Linq to your indicator
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Internals;
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
07 Sep 2018, 09:39
Hi alidarvish64@yahoo.com,
The error message indicates that there is not enough money in your account to trade. From a brief view in your logic, it seems that you are opening several positions in OnTick() without any check if the position has already been opened. This is also visible in the log you attached. I would suggest to revisit your logic. Probably you should use OnBar() instead of OnTick().
Best Regards
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
06 Sep 2018, 17:02
Hi swingfish,
You dont need to make a loop. just keep the code outside the if-else statement at the botton of the calculate funtion. See below
if (CurrentDay == oldCurrentDay) { double sum = 0.0; for (int i = start_bar; i <= end_bar; i++) { sum += MarketSeries.Close[i]; VWAP[i] = TotalPV / TotalVolume; for (int k = start_bar; k <= i; k++) { double HLC = (MarketSeries.High[k] + MarketSeries.Low[k] + MarketSeries.Close[k]) / 3; double OHLC = (MarketSeries.High[k] + MarketSeries.Low[k] + MarketSeries.Open[k] + MarketSeries.Close[k]) / 4; double avg = HLC; double diff = avg - VWAP[i]; } // cut vwap short } } else { oldCurrentDay = MarketSeries.OpenTime[end_bar].DayOfYear; start_bar = end_bar - TimeOffset; } if (!ShowHistoricalvWap) { if (i < index - 15) { VWAP[i] = double.NaN; } // this does not work (supposed to delete the old days data }
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
06 Sep 2018, 16:34
Hi useretinv,
You can use the code below
if (position.GrossProfit > 0) { ExecuteOrder(InitialQuantity, GetRandomTradeType()); } else { if (position.TradeType == TradeType.Buy) ExecuteOrder(position.Quantity * 2, TradeType.Sell); else ExecuteOrder(position.Quantity * 2, TradeType.Buy); }
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
06 Sep 2018, 16:16
Hi swingfish,
It seems that you are running that part only for the last day because of the following statement
if (CurrentDay == oldCurrentDay) {
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
06 Sep 2018, 15:03
Hi beneditobvn,
Is it possible to rearrange the order of the tags of your messages as in our documentation examples i.e. the tags in the login message should be sent in the following order
8=FIX.4.4|9=126|35=A|49=theBroker.12345|56=CSERVER|34=1|52=20170117- 08:03:04|57=TRADE|50=any_string|98=0|108=30|141=Y|553=12345|554=passw0rd!|10=131|
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
06 Sep 2018, 13:58
Hi Sasha,
Can you explain why it doesn't work? What does it do and what did you expect it to do?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
06 Sep 2018, 11:30
Hi Sasha,
Yes correct.
alidarvish64@yahoo.com I have deleted your posts, please create a new thread for your issue
@PanagiotisCharalampous
PanagiotisCharalampous
06 Sep 2018, 11:25
Hi,
Here it is https://ctrader.com/api/reference/positions/count and https://ctrader.com/api/reference/position/entrytime.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
06 Sep 2018, 10:43
Hi Carlos,
You can check if Positions.Count < 5 before proceeding to executing an order.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
06 Sep 2018, 10:09
( Updated at: 23 Jan 2024, 13:14 )
Hi Waxy,
We post changes regarding major updates in [What's New]. Changes for minor updates are not usually posted.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
05 Sep 2018, 16:29
Hi carlosdrcunha,
It seems that you have a condition for this in the code
if (cBotPositions.Length >= 1) return;
but you do not add a label when executing an order.
ExecuteMarketOrder(TradeType.Buy, Symbol, Volume);
If you add the label, you will probably solve your problem.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
05 Sep 2018, 15:53
Hi alidarvish64@yahoo.com,
Thanks for posting in our forum. Could you please create a new thread for this issue since it does not seem to be related with the original post?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
05 Sep 2018, 14:22
Hi jt.mechanical,
The new mobile applications are not just an update of the previous ones but brand new applications written from scratch. Most of the missing features will be gradually added to the new applications as well.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
05 Sep 2018, 14:19
Hi Sasha,
In the code sample above, whenever the if statement is true, then you have a new candle.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
05 Sep 2018, 12:09
Hi carlosdrcunha,
Can you share your cBot code and explain to us what would you expect the cBot to do?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
07 Sep 2018, 10:26
Hi swingfish,
"thanks for the reply, for some reason cTrader 3.0 and 3.01 do not have the Positions.Average call ".
This is not part of cTrader but of .Net. As i said you need to use System.Linq library.
Best Regards,
Panagiotis
@PanagiotisCharalampous