
Topics
Replies
PanagiotisCharalampous
17 Feb 2020, 09:56
Hi reza h,
Your question is very general for somebody to give you a specific answer. So I will try to give a general answer to a general question, in case it helps. Use a flag that will be raised when the first hammer is detected. When the flag has been raised, do not detect any hammers. Lower the flag whenever you think it should be lowered.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
17 Feb 2020, 09:50
Hi traderfxmaster007,
See below
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
//using cAlgo.Lib;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class LEXtrend : Indicator
{
[Parameter("LEX Period", DefaultValue = 14, MinValue = 1, MaxValue = 25)]
public int Period { get; set; }
[Parameter("LEX Threshold", DefaultValue = 20, MinValue = 20, MaxValue = 60)]
public int Threshold { get; set; }
[Parameter("Arrow Offset", DefaultValue = 5, MinValue = 1, Step = 1)]
public double arrowOffset { get; set; }
private string upArrow = "▲";
private string downArrow = "▼";
private IchimokuKinkoHyo Ichimoku;
private DirectionalMovementSystem dms;
protected override void Initialize()
{
Ichimoku = Indicators.IchimokuKinkoHyo(9, 26, 52);
dms = Indicators.DirectionalMovementSystem(Period);
arrowOffset = Symbol.PipSize * arrowOffset;
}
public override void Calculate(int index)
{
double high = Bars.HighPrices[index];
double low = Bars.LowPrices[index];
if (BuySignal())
Chart.DrawStaticText(string.Format("Buy {0}", index), upArrow, VerticalAlignment.Top, HorizontalAlignment.Center, Color.Lime);
if (SellSignal())
Chart.DrawStaticText(string.Format("Sell {0}", index), downArrow, VerticalAlignment.Top, HorizontalAlignment.Center, Color.Red);
}
#region Predicate
public bool BuySignal()
{
return Bars.ClosePrices.Last(1) > Bars.OpenPrices.Last(1) && Bars.ClosePrices.Last(1) > Ichimoku.KijunSen.Last(1) && dms.DIPlus.Last(1) > dms.DIMinus.Last(1) && dms.DIPlus.Last(1) > Threshold && (Bars.ClosePrices.Last(2) < Bars.OpenPrices.Last(2) || Bars.ClosePrices.Last(2) < Ichimoku.KijunSen.Last(2) || dms.DIPlus.Last(2) < dms.DIMinus.Last(2) || dms.DIPlus.Last(2) <= Threshold);
}
public bool SellSignal()
{
return Bars.ClosePrices.Last(1) < Bars.OpenPrices.Last(1) && Bars.ClosePrices.Last(1) < Ichimoku.KijunSen.Last(1) && dms.DIPlus.Last(1) < dms.DIMinus.Last(1) && dms.DIMinus.Last(1) > Threshold && (Bars.ClosePrices.Last(2) > Bars.OpenPrices.Last(2) || Bars.ClosePrices.Last(2) > Ichimoku.KijunSen.Last(2) || dms.DIPlus.Last(2) > dms.DIMinus.Last(2) || dms.DIMinus.Last(2) <= Threshold);
}
#endregion
}
}
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
17 Feb 2020, 09:46
Hi martins,
There is no such option at the moment.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
17 Feb 2020, 09:44
Hi acrigney,
Probably there is an open position in loss that causes this.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
17 Feb 2020, 09:41
Hi Vipin,
This example is not supported anymore. Read more here.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
17 Feb 2020, 09:28
Hi danielvme,
Thanks for your suggestion. Please post your suggestions in the Suggestions section of the forum.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
17 Feb 2020, 09:26
Hi henderson.nigel,
No there is no such setting. Please make sure you are using the same setting i.e. optimization method and cBot parameters.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
17 Feb 2020, 09:23
Hi ctid229331,
Please try a clean installation and let us know if it resolves the issue.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
17 Feb 2020, 09:20
Hi GlenHendriks,
Please post your suggestions in the Suggestions section of the forum.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
17 Feb 2020, 09:15
RE:
Hi 1222Ht,
A hotfix has been released to Beta last weeks which fixes several issues but it has not been pushed to brokers. Please have a look again as soon as the hotfix is pushed to your broker's cTrader.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
17 Feb 2020, 09:10
Hi Xavier R,
Can you please post the complete cBot code in text format so that we can use it to reproduce the issue?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
17 Feb 2020, 09:07
Hi ctid1006205,
We will need more information in order to investigate this issue. Please let us know the following
- The strategy name.
- The trading account number and the broker of the follower's account.
- A screenshot of the strategy provider's position with exact entry and exit times.
- The position ID for which you you expected the TP to be triggered but was not.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
17 Feb 2020, 08:59
Hi Tj11,
No there is no such option. When the timeframe changes, a new indicator is initialized and the Initialize() method is called.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
17 Feb 2020, 08:50
Hi firemyst,
If you notice, your entry price has a lot of decimal places, probably caused by the fact that it is a VWAP price. Thus you should expect your pips to have a lot of decimal places as well.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
17 Feb 2020, 08:45
Hi Mr. John,
We do not have plans to add this at the moment but this can be programmed by you in a custom indicator.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
13 Feb 2020, 16:53
Hi A.R.
This usually happens if your cBot/Indicator has parameter declared as static. If you remove the static keyword, the issue should be resolved.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
13 Feb 2020, 12:08
Hi firemyst,
Why do you think this is an issue?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
13 Feb 2020, 09:44
Hi Takis,
Symbols.GetSymbol() doesn't work in optimization. You will need to replace the references to symbol with strings.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
13 Feb 2020, 09:16
Hi thoy1,
See below
Symbol symbol = Symbols.GetSymbol(position.SymbolName);
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
17 Feb 2020, 12:11
Hi Pep,
1) The reason behind the NaN values is that you are trying to access indices with negative values (index - ik). You should make the relevant checks and make sure you are using an index with a positive value.
2) The gap issue is not related with the NaN issue. To fix the gap issue just start adding values from the index before i.e. the start index and value of the green series should be the same with the end index and value of the red series and vise versa.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous