Topics
Replies
firemyst
21 Jan 2021, 05:14
( Updated at: 21 Jan 2021, 05:15 )
From the code you provided above, you need to do two things:
1) remove #endregion as there's no corresponding #region tag
2) Change the line
private PRC newprc;
to
private PolynomialRegressionChannels newprc;
because there is no "PRC" object type defined in your code.
@firemyst
firemyst
20 Jan 2021, 08:07
It's a nullable type.
Anytype in C# that ends in a "?" is a nullable type.
This basically only applies to primitive types though, because objects (such as strings) are inherently nullable.
So a type of int? means it's nullable whereas a type of just plain int is not.
int x = 16 is fine.
int? x = 16 is fine.
int? x = null is fine.
int x = null is not fine.
@firemyst
firemyst
18 Jan 2021, 14:36
RE:
PanagiotisCharalampous said:
Hi firemyst,
The cloud is not assossiated with anything, it is a separate entity which is drawn between two lines. We have no plans for an on/off feature at the moment, but you can suggest it.
Best Regards,
Panagiotis
Hi @Panagiotis:
So Spotware includes a charting feature in cTrader that provides traders with zero control over the colors, zero control over any of its display features, and zero ability to even turn it on or off?
With all due respect and with that lack of basic functionality, such features shouldn't have to be "suggested".
Thank you :-)
@firemyst
firemyst
10 Jan 2021, 11:44
RE:
PanagiotisCharalampous said:
Hi EagleMoxy,
No it doesn't. You obfuscate dll files that can can be decompiled, just to make the life of the perpetrator a bit harder. There is no point to obfuscate encrypted files.
Best Regards,
Panagiotis
Two points for clarification/confirmation @Panagiotis:
1) Spotware hypothetically (more than likely) has the ability to decrypt files as most other brokers that have custom software that encrypts code also has the ability to decrypt it. So any calgo files can be decrypted by Spotware, correct?
2) Are the files also encrypted when compiled from within Visual Studio?
Thank you.
@firemyst
firemyst
08 Jan 2021, 02:46
RE:
PanagiotisCharalampous said:
Hi apon.ru.bd,
Unfortunately this information is not available in the HistoricalTrade class.
Best Regards,
Panagiotis
Just to clarify, the "reason" is available, but the actual stoploss/take-profit value isn't, correct @Panagiotis?
@apon.ru.bd, you said, "I need to check closing reason in tick method, not from positionClosing method."... so put the code in the OnTick method rather than the closing one.
That's a lot of extra CPU time wasted though checking the Historical Trade information on every tick.
Also, there is a way to get the stoploss value when a position is closed. Every time OnTick is called, save the current stoploss value in a global class variable; then in the PositionsClosed method check the value of it (as it should have the latest)
Rough code sample:
private double _lastSLValue = -1;
OnTickMethod( ... )
{
//whatever
//check to make sure you have a position
//you may also need to check if you have an SL if you don't always assign one
if (p != null)
_lastSLValue = p.StopLoss.GetValueOrDefault();
//whatever
}
PositionsClosedMethod ( ... )
{
//do whatever you need to with _lastSLValue
// more stuff
//reset the value if you need to
_lastSLValue = -1;
}
@firemyst
firemyst
07 Jan 2021, 15:14
RE: RE:
EagleMoxy said:
*( is there a way to get email notifications when a question is answered in the forum?)
Yes, there is.
You have to click the "Subscribe" button at the top of the page after you submit your response.
This forum doesn't automatically subscribe you to replies.
@firemyst
firemyst
07 Jan 2021, 15:13
private void OnPositionsClosed(PositionClosedEventArgs args)
{
Print("Closed");
var position = args.Position;
if (position.Label != "Martingale22" || position.SymbolName != SymbolName)
return;
//What kind of "delay" do you want?
//To wait x-milliseconds
Thread.Sleep(1000); //waits 1 second. You may have to import system.threading
if (position.GrossProfit > 0)
{
ExecuteOrder(InitialQuantity, TradeType.Buy);
}
}
@firemyst
firemyst
07 Jan 2021, 08:50
I suspect your error is on this line:
BB = Indicators.BollingerBands(wvf, bbl, mult, MovingAverageType.Simple);
wvf is not a "DataSeries" object; it's a "double".
That's the first parameter required when using that BollingerBands constructor is a DataSeries. For example, the close prices, high prices, low prices, open prices, etc.
@firemyst
firemyst
07 Jan 2021, 08:40
( Updated at: 07 Jan 2021, 08:42 )
Sample code to get such information:
Position p1 = args.Position;
//Now get the historical trade stuff.
HistoricalTrade ht = History.FindLast(p1.Label, p1.SymbolName, p1.TradeType);
if (ht != null)
{
double cp = ht.ClosingPrice;
Print("Position \"{0} {1}\" closed for reason {2} with {3} profit. Entry Price {4}, Closing Price {5}, StopLoss {6}", p1.Id, p1.Label, args.Reason, String.Format("{0:$#,###.00}", p1.GrossProfit), p1.EntryPrice, cp, p1.StopLoss);
}
The only other thing you'll have to do is narrow down the position(s) returned if you have multiple.
For example:
if (p1.SymbolName == Symbol.Name && p1.Label == thePositionLabel)
{ ... }
@firemyst
firemyst
26 Dec 2020, 16:29
RE: RE: RE:
vincenzo.dal.mare said:
firemyst said:
vincenzo.dal.mare said:
Hello guys,
how can i enter the jurik moving average?
in the list of moving average available it does not appear even though I have downloaded it in my indicators.
can you give me a hand?
thank you all.If you downloaded and installed it, then it should be under "indicators -> custom" and in that list.
If it's not there, then you probably didn't double-click to install the calgo file.
hello thanks for your answer. let me explain better ... I'm testing some trial and free cbots. I noticed that in the bot parameters window there are many types of moving averages, simple, exponential, weighted, triangular etc. however the jurik one is missing, despite having installed it in ctrader. can you make it appear in the list? thanks
No.
Only cTrader (Spotware) can do that. The only moving averages contained within that list are those that are natively included within cTrader.
If you want a Jurik moving average within a cBot, you have to make a separate parameter for it.
@firemyst
firemyst
26 Dec 2020, 12:55
RE:
vincenzo.dal.mare said:
Hello guys,
how can i enter the jurik moving average?
in the list of moving average available it does not appear even though I have downloaded it in my indicators.
can you give me a hand?
thank you all.
If you downloaded and installed it, then it should be under "indicators -> custom" and in that list.
If it's not there, then you probably didn't double-click to install the calgo file.
@firemyst
firemyst
26 Dec 2020, 12:53
How do you define in an "uptrend" and "downtrend"? A bot doesn't just think "in an uptrend"... you have to define conditions that define what you think an "uptrend" is that can be programmed.
And how do you define "when resistance is formed"? What's "resistance"? When price doesn't break a certain level after x-candles? On each bar? On each tick? What happens if it breaks that line, comes back to stop you out, and then immediately breaks the line again? Do you get back in? Or leave it for several bars? Something else?
You should be a bit more specific in your requirements.
@firemyst
firemyst
19 Dec 2020, 15:36
For the trailing stop, change the ExecuteMarketOrder lines to have the following:
ExecuteMarketOrder(TradeType.Sell, Symbol, VolumeInUnits, label, SL, TP, null, true, null);
and
ExecuteMarketOrder(TradeType.Buy, Symbol, VolumeInUnits, label, SL, TP, null, true, null);
@firemyst
firemyst
23 Jan 2021, 08:31
As the error message says, why do you think there's a property called "Result"?
There clearly isn't one, so you'll have to figure out what property you need to reference to get the latest value. Not every indicator has a "Result" field nor is it required to.
So the best way to tackle this problem is change the line from "Ema.Result.LastValue" to just "Ema". Once you have that, type the period "." to see if any properties show up. Then you'll have to pick from the list if they do.
If they don't, you need to either be able to see the source code to see what the property is, read the documentation, or get in contact with the indicator's author.
@firemyst