Topics
Replies
atrader
24 Jan 2014, 12:25
protected override void OnStart() { double risk = 0; foreach (var position in Positions) { Symbol symbol = MarketData.GetSymbol(position.SymbolCode); if (position.StopLoss != null) { var stopLoss = Math.Abs(position.EntryPrice - (double)position.StopLoss) / symbol.PipSize; risk += stopLoss * symbol.PipValue * position.Volume; } } Print(risk); Stop(); }
I think that should work.
@atrader
atrader
21 Jan 2014, 11:46
RE:
http://vote.spotware.com/forums/229166-ideas-and-suggestions-for-ctrader-and-calgo/suggestions/5356525-optimization
jobenb said:
Hi Spotware
First of all - Congrats on a platform with outstanding possibilities and potential.
We really need to be able to optimise our algos. It is really annoying not to be able to optimise and to try and do it manually is a complete waste of time.
Please can you tell us when we can expect a new version of cAlgo that will have the ability to optimise?
Thank you!
@atrader
atrader
19 Dec 2013, 11:17
It looks like the super profit indicator /algos/indicators/show/249
@atrader
atrader
10 Dec 2013, 10:24
RE:
You can use DrawText to display text on the chart. If you choose H4 or above you can see the 2011 chart.
zemotoca said:
There configuring BELKHAYATE PRC indicator to display its parameters at the time for a stipulated period (120 periods for example), but it is presented in a chart since 2011?
@atrader
atrader
05 Dec 2013, 14:10
Why filter positions by timeframe? Or how does timeframe relate to a position?
You can filter positions by label, symbol and trade type with FindAll.
// pass the empty string as the label argument to find positions entered manually // and assign a label to positions opened by the robot var positions = Positions.FindAll("", Symbol); foreach (var position in positions) { }
@atrader
atrader
21 Nov 2013, 09:59
RE:
gedet said:
Thanks for the response I really appreciate the help. You are right about DOM I added the code in the calculate method, however the problem is that the indicator compares the current price with the future spanA and spanB (26 periods in the future) I cannot find a way to compare the current price to the current spanA and spanB values.
Instead of cloudM1.SenkouSpanA.LastValue you would need cloudM1.SenkouSpanA[ indexM1], where indexM1 = seriesM1.Close.Count - 1 (the last index for the seriesM1 )
Also, see the examples here for translating indexes between different series: /forum/whats-new/1463#3
@atrader
atrader
20 Nov 2013, 10:44
( Updated at: 21 Dec 2023, 09:20 )
You don't need DOM for this. Just use Symbol instead of MySymbol. Remove this:
MySymbol = MarketData.GetMarketDepth(Symbol); MySymbol.Updated += doCalculate;
You can add the code from doCalculate in the Calculate method.
I get this result
@atrader
atrader
14 Nov 2013, 15:52
Hi this might help you get started to make your indicator: /algos/indicators/show/371
@atrader
atrader
07 Nov 2013, 17:55
Are you trying to print to the log or draw text on the chart?
Once you draw something on the chart with ChartObjects it will stay on the screen unless you call RemoveObject or RemoveAllObjects.
If it didn't work it means the equity didn't reach the target or you set the bool targetlevel1 to true previously in the code.
@atrader
atrader
28 Jan 2014, 18:02
Maybe this is a start...
@atrader