Topics
Replies
JeremyG
30 Oct 2015, 21:18
RE:
I'm not asking for the source code, I just want to know what price it's using, i.e. open,close, weighted close etc?
This shouldn't be a secret, I'm just wondering how to interpret the results, especially as I don't see it correlating with any other setup I have seen in other platforms.
Spotware said:
Dear Trader,
We do not provide source code of our standard indicators.
Many users upload their Indicators/cBots in cTDN. You can try to find a CCI Indicator that suits your needs in Indicators library. If you cannot find it there you can also contact one of our Partners for further help or post a job in Development Jobs section. You could also try to create your own CCI indicator.
@JeremyG
JeremyG
27 Jun 2015, 18:41
RE: RE:
I meant to say your positions won't CLOSE if RSI passes over 50 but was never exactly 50.
JeremyG said:
A couple tips:
When using IF statements etc, you gotta use two equals signs when comparing two numbers, eg:
if (rsi.Result.LastValue == 50)
Another problem is that your position's won't work if RSI passes over 50 but was never exactly 50.
DontAlgoMe said:
So I have no knowledge of coding and Im just trying to figure it out based on the sample bots.
I want a bot that opens a buy position when rsi < 15 and open a sell position when rsi > 85. I want to have a 10 pip stop on my positions, and I want the positions to close when RSI reverts to 50.
This is what I ended up with tampering with the code... I dont think its working because adjusting values doesnt change my backtesting results. So Im pretty sure I butchered the language.
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class Customizedrsibot : Robot
{
[Parameter("Source")]
public DataSeries Source { get; set; }
[Parameter("Periods", DefaultValue = 14)]
public int Periods { get; set; }
[Parameter("Volume", DefaultValue = 10000, MinValue = 1000)]
public int Volume { get; set; }
[Parameter("Inital Stop Loss (pips)", DefaultValue = 10.0)]
public int init_StopLoss { get; set; }
private RelativeStrengthIndex rsi;
protected override void OnStart()
{
rsi = Indicators.RelativeStrengthIndex(Source, Periods);
}
protected override void OnTick()
{
if (rsi.Result.LastValue = 50)
{
Close(TradeType.Sell);
if (rsi.Result.LastValue < 15)
{
Open(TradeType.Buy,PlaceStopOrder)
}
else if (rsi.Result.LastValue = 50)
{
Close(TradeType.Buy);
if (rsi.Result.LastValue > 85)
{Open(TradeType.Sell,PlaceStopOrder)
}
private void Close(TradeType tradeType)
{
foreach (var position in Positions.FindAll("SampleRSI", Symbol, tradeType))
ClosePosition(position);
@JeremyG
JeremyG
27 Jun 2015, 18:38
RE:
A couple tips:
When using IF statements etc, you gotta use two equals signs when comparing two numbers, eg:
if (rsi.Result.LastValue == 50)
Another problem is that your position's won't work if RSI passes over 50 but was never exactly 50.
DontAlgoMe said:
So I have no knowledge of coding and Im just trying to figure it out based on the sample bots.
I want a bot that opens a buy position when rsi < 15 and open a sell position when rsi > 85. I want to have a 10 pip stop on my positions, and I want the positions to close when RSI reverts to 50.
This is what I ended up with tampering with the code... I dont think its working because adjusting values doesnt change my backtesting results. So Im pretty sure I butchered the language.
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class Customizedrsibot : Robot
{
[Parameter("Source")]
public DataSeries Source { get; set; }
[Parameter("Periods", DefaultValue = 14)]
public int Periods { get; set; }
[Parameter("Volume", DefaultValue = 10000, MinValue = 1000)]
public int Volume { get; set; }
[Parameter("Inital Stop Loss (pips)", DefaultValue = 10.0)]
public int init_StopLoss { get; set; }
private RelativeStrengthIndex rsi;
protected override void OnStart()
{
rsi = Indicators.RelativeStrengthIndex(Source, Periods);
}
protected override void OnTick()
{
if (rsi.Result.LastValue = 50)
{
Close(TradeType.Sell);
if (rsi.Result.LastValue < 15)
{
Open(TradeType.Buy,PlaceStopOrder)
}
else if (rsi.Result.LastValue = 50)
{
Close(TradeType.Buy);
if (rsi.Result.LastValue > 85)
{Open(TradeType.Sell,PlaceStopOrder)
}
private void Close(TradeType tradeType)
{
foreach (var position in Positions.FindAll("SampleRSI", Symbol, tradeType))
ClosePosition(position);
@JeremyG
JeremyG
27 Jun 2015, 18:33
RE: RE:
Hey, you're really gonna have to devote time to learning the basics of c# and cAlgo (the language and the program) and do a lot of testing and tweaking of your strategy.
Watch youtube videos, read the microsoft help files, read through this forum, keep breaking and fixing the reference cBots. Start with very simple building blocs and add complexity from there.
Not to discourage you in any way, but I can absolutely promise you that your current strategy won't work without a fair amount of tweaking and you'll need to know how to tweak it to get it to where you want it.
Keep going, I was an absolute beginner not even two months ago and now I can code my own robots. It takes time but knowing how to code your strategies yourself is invaluable.
Sorry I can't help more specifically with the code you posted..
DontAlgoMe said:
I would also like to be able to set profit targets based on pips that close the position rather than the rsi value, to see which works better.
@JeremyG
JeremyG
18 Dec 2015, 17:00
RE: RE:
Hi Spotware,
It's December 2015 and we're still waiting for Renko bars.
As has been mentioned many times round here, this is a major drawback for cTrader..
Any updates?
Thanks
Jeremy
@JeremyG