Topics
Replies
rkokerti
26 Apr 2013, 13:07
( Updated at: 21 Dec 2023, 09:20 )
Hi Kricka,
Maybe this help you to close the % of open positions...
For example:
1, You have a position (100k)
2, double click to position on chart
3, select the value you need to close (20k)
4, click on red button.... you will have 80k open position
See screenshot below:
@rkokerti
rkokerti
26 Apr 2013, 12:43
Yes, my "dream" has come true... /forum/suggestions/80
Excellent job Developers!!! Thanks so much.
I think cAlgo will the market leader... ;)
@rkokerti
rkokerti
14 Apr 2013, 15:56
( Updated at: 21 Dec 2023, 09:20 )
Hello Admin!
I asked the same on the 11th Nov 2012! Half a year ago! See here: /forum/calgo-support/129
My new test results below:
Please investigate it!
Thanks
@rkokerti
rkokerti
10 Apr 2013, 18:24
Hi PCWalker!
I wrote a code that export Backtest data to Excel.
You can find it here: /algos/robots/show/201
I know it is not an add-in, but maybe helps you.
@rkokerti
rkokerti
08 Feb 2013, 12:09
RE: RE: spread indicator
MaXeY said:Hello
anyone have spread indicator for Ctrader ?
I use this one at the momment it almost in sink with the actual spread Tick Chart /algos/show/207
or you could use Lables for Charts /algos/show/195 just remove the infomation you dont want and set the indicator to false so that its not on your chart and in your way, I triying to work out how to calculate the pip differance between moving averages that will be printed using Lables. But I can think of a few good thing that could also be added such as RSI.
Hi Scott,
Try this...
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo.Indicators
{
[Indicator(IsOverlay = true)]
public class _RI_WriteToChart_v2 : Indicator
{
//-----------------------------------------------------------------
[Parameter]
public DataSeries Source { get; set; }
[Parameter(DefaultValue = 14)]
public int PeriodMA1 { get; set; }
[Parameter(DefaultValue = 7)]
public int PeriodMA2 { get; set; }
//-----------------------------------------------------------------
private Position position;
private SimpleMovingAverage sma1;
private SimpleMovingAverage sma2;
private double Dist;
//-----------------------------------------------------------------
protected override void Initialize()
{
sma1 = Indicators.SimpleMovingAverage(Source,PeriodMA1);
sma2 = Indicators.SimpleMovingAverage(Source,PeriodMA2);
}
//-----------------------------------------------------------------
public override void Calculate(int index)
{
string Dist = " " + Math.Round((sma1.Result[index] - sma2.Result[index]) / Symbol.PipSize,0);
ChartObjects.DrawText("Labels",
"Dist:" + "\n"
, StaticPosition.TopLeft, Colors.Yellow);
ChartObjects.DrawText("Dist", Dist, StaticPosition.TopLeft, Colors.LightBlue);
}
}
}
@rkokerti
rkokerti
02 Dec 2012, 13:53
( Updated at: 21 Dec 2023, 09:20 )
Hello,
I revoke my previous comment, that everything is fine with backtest result!!!
I tested the robot what coded by you Admin, the name is: „Sample SAR Trailing Stop”. This code is default in cAlgo.
Code:
// -------------------------------------------------------------------------------------------------
//
// This code is a cAlgo API sample.
//
// This robot is intended to be used as a sample and does not guarantee any particular outcome or
// profit of any kind. Use it at your own risk
//
// All changes to this file will be lost on next application start.
// If you are going to modify this file please make a copy using the "Duplicate" command.
//
// The "Sample SAR Trailing Stop Robot" will create a market Buy order if the parabolic SAR of the previous bar is
// below the candlestick. A Sell order will be created if the parabolic SAR of the previous bar is above the candlestick.
// The order's volume is specified in the "Volume" parameter. The order will have a trailing stop defined by the
// previous periods' Parabolic SAR levels. The user can change the Parabolic SAR settings by adjusting the "MinAF"
// and "MaxAF" parameters.
//
// -------------------------------------------------------------------------------------------------
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo.Robots
{
[Robot]
public class SampleSARTrailingStop : Robot
{
[Parameter("Min AF", DefaultValue = 0.02, MinValue = 0)]
public double MinAF { get; set; }
[Parameter("Max AF", DefaultValue = 0.2, MinValue = 0)]
public double MaxAF { get; set; }
[Parameter("Volume", DefaultValue = 10000, MinValue = 0)]
public int Volume { get; set; }
private Position position;
private ParabolicSAR parabolicSAR;
protected override void OnStart()
{
parabolicSAR = Indicators.ParabolicSAR(MinAF, MaxAF);
}
protected override void OnTick()
{
if (position == null && !Trade.IsExecuting)
{
var command = parabolicSAR.Result.LastValue < Symbol.Bid ? TradeType.Buy : TradeType.Sell;
Trade.CreateMarketOrder(command, Symbol, Volume);
Print("TradeCommand is {0}, Parabolic SAR is {1}, Bid is {2}", command, parabolicSAR.Result.LastValue, Symbol.Bid);
}
if (position != null && !Trade.IsExecuting)
{
double newStopLoss = parabolicSAR.Result.LastValue;
bool isProtected = position.StopLoss.HasValue;
if (position.TradeType == TradeType.Buy && isProtected)
{
if (newStopLoss > Symbol.Bid) return;
if (newStopLoss - position.StopLoss < Symbol.PointSize) return;
}
if (position.TradeType == TradeType.Sell && isProtected)
{
if (newStopLoss < Symbol.Bid) return;
if (position.StopLoss - newStopLoss < Symbol.PointSize) return;
}
Trade.ModifyPosition(position, newStopLoss, null);
}
}
protected override void OnPositionOpened(Position openedPosition)
{
position = openedPosition;
}
protected override void OnPositionClosed(Position position)
{
Stop();
}
}
}
If you add for example EUR/USD instance to robot, and run a test you will see the result is INCORRECT again!!! Where these S/L values are coming???
Add the indicator PSAR to chart (settings: MinAF:0.02, MaxAF:0.2) and compare the indicator value with test result values. DO NOT MACH!
This statement is also true for other robots that use indicator value as stoploss!!!
If build a strategy to a backtest result, so many trader will be disappointed!!!
Please investigate it thoroughly, and fix it as soon as possible, because we waited for weeks for a well-functioning backtest!!!!
Thanks
@rkokerti
rkokerti
01 Dec 2012, 11:18
Hello,
I thing the profit is very nice, but not all.
Your DrawDown is almost 90%!!! It is huge... Why are you earn money if then you lose it all? My opinion is that 10-20% of DrawDown is the maximum which guarantees the continuous earning, and well-balanced trading. It is only my point of view, but be careful with 90% DD.
Good luck!
@rkokerti
rkokerti
22 Oct 2013, 14:06
Very welcome... and thanks for quick response! I'm waiting for the fix, because it's necessary for the Currency-Index calculation.
@rkokerti