Topics
Replies
VIZAINT
04 Nov 2024, 21:56
RE: custom indicator does not appear
dave.anderson.consulting said:
Probably a cTrader 5.0.40 issue. Many seem to have this kind of weird issues since upgrading to 5.0.40.
For the future consider installing a version of your broker instead of the latest version of cTrader. The lateste versie seems to be a kind of test version.
Gracias lo tendrĂ© en cuenta đ
@VIZAINT
VIZAINT
02 Oct 2024, 08:26
The way I know to get Entry Price is when the position is executed and this is the way I use:
ExecuteMarketOrderAsync(TradeType.Buy, SymbolName, _volumeInUnits, Label, OnCompletedBuy);
and metod OnCompletedBuy:
private void OnCompletedBuy(TradeResult result)
{
if (!result.IsSuccessful)
Print("Error: ", result.Error);
result.Position.ModifyStopLossPips(10);
result.Position.ModifyTakeProfitPips(100);
EntryPrice = result.Position.EntryPrice;
}
@VIZAINT
VIZAINT
27 Sep 2024, 16:52
( Updated at: 27 Sep 2024, 16:53 )
Display indicator on unhide - example
I have prepared this example, to check on the chart, it hides it for a while depending on the timeframe, if it is a minute, then something more than 1 minute and then unhide. The rectangle does not appear
img desrcip - the result of code
//--------------------------------------------------------------------------------//
public override void Calculate(int index)
{
DateTime openDay = DateTime.Now;
var Start = new DateTime(openDay.Year, openDay.Month, openDay.Day, openDay.Hour - 5, 0, 0, DateTimeKind.Utc);
var End = new DateTime(openDay.Year, openDay.Month, openDay.Day, openDay.Hour, 0, 0, DateTimeKind.Utc);
var Rect = Chart.DrawRectangle("Rect", Start, Chart.TopY, End, Chart.BottomY, Color.FromArgb(50, Color.Crimson));
Rect.IsFilled = true;
}
@VIZAINT
VIZAINT
19 Sep 2024, 07:13
( Updated at: 19 Sep 2024, 09:34 )
Display indicator on unhide -Code
Nothing out of the ordinary, there is a method of creating the box and then in Calculation it is repeated 10 times, to form part of the vertical line on the right.
public override void Calculate(int index) {
for (int ib = 0; ib < 10; ib++)
{
////////////
///---------------
///////////
DrawMyRectangle(ib, index, Start, End, currentPrice, by10, MaxBoxIndex, MinBoxIndex);
}
}
public ChartRectangle DrawMyRectangle(int ib, int ind, int start, int end, double currPrice, double by10, double MaxBoxIndex, double MinBoxIndex)
{
double sum = Xcind(ind, start, end);
List<double> mSum = new();
mSum.Add(sum);
var Minut = TimeFrame.GetHashCode();
var newOffset = Minut * OffsetBox;
var topbx = by10 - (by10 * 0.1);
var btmbx = by10 - (by10 * 0.9);
var newColor = sum > 0 ? Color.FromArgb(TranspBox, UpColor) : Color.FromArgb(TranspBox, DownColor);
////////////
///---------------
///////////
return rec;
}
@VIZAINT
VIZAINT
05 Nov 2024, 12:04
Es una putada, he instalado ctrader de otro broker y ocurre lo mismo, al cambiar timeframe los indicadores propios no aparecen.
@VIZAINT