Bot with custom indicator the heaviest challenge yet faced
Bot with custom indicator the heaviest challenge yet faced
09 Nov 2020, 04:05
(Pani is now the moment of truth, the heaviest challenge yet faced, BUT I BELIEVE WE WILL WIN) I've been trying to program a bot that uses a custom indicator. But I have no idea how I can do this. Can someone help me by giving a tip? My goal is to make a purchase whenever the price crosses below the bullish cross. and sell when the price crosses the low line up The indicator is just below
Replies
samuel.jus.cornelio
09 Nov 2020, 15:10
RE:
PanagiotisCharalampous said:
Hi samuel.jus.cornelio,
Here is how to reference a custom indicator.
Best Regards,
Panagiotis
Thanks Pani, I will work with this
@samuel.jus.cornelio
samuel.jus.cornelio
11 Nov 2020, 14:55
RE:
PanagiotisCharalampous said:
Hi samuel.jus.cornelio,
Here is how to reference a custom indicator.
Best Regards,
Panagiotis
I tried in many ways to make this reference, but I just wasn't successful. Pani, could you please give me a concrete example of how to do this?
Below is the indicator in question
@samuel.jus.cornelio
PanagiotisCharalampous
11 Nov 2020, 15:24
Hi samuel.jus.cornelio,
Here is an example
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class NewcBot : Robot
{
[Parameter(DefaultValue = 0.5)]
public double Deviation { get; set; }
[Parameter("% Retracement", DefaultValue = 38.2)]
public double per { get; set; }
NewIndicator _indicator;
protected override void OnStart()
{
_indicator = Indicators.GetIndicator<NewIndicator>(Deviation, per);
}
protected override void OnTick()
{
// Put your core logic here
}
protected override void OnStop()
{
// Put your deinitialization logic here
}
}
}
Best Regards,
Panagiotis
@PanagiotisCharalampous
samuel.jus.cornelio
11 Nov 2020, 18:46
RE:
PanagiotisCharalampous said:
Hi samuel.jus.cornelio,
Here is an example
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class NewcBot : Robot { [Parameter(DefaultValue = 0.5)] public double Deviation { get; set; } [Parameter("% Retracement", DefaultValue = 38.2)] public double per { get; set; } NewIndicator _indicator; protected override void OnStart() { _indicator = Indicators.GetIndicator<NewIndicator>(Deviation, per); } protected override void OnTick() { // Put your core logic here } protected override void OnStop() { // Put your deinitialization logic here } } }
Best Regards,
Panagiotis
Thank you very much, Pani I managed to reference the indicator because of your tips You are the man!
now i'm trying to put a business condition using this indicator Please how can I do this efficiently? see how I'm trying
the idea is whenever the price is below the indicator's retraction line that he makes a trade
if (_1hstoch2.PercentK.LastValue > 80)
if ( Symbol.Ask < (NewIndicator, per, 38,2))
ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "bot", StopLoss, TakeProfit);
@samuel.jus.cornelio
Shares4UsDevelopment
13 Nov 2020, 13:19
RE: RE:
if (_1hstoch2.PercentK.LastValue > 80)
if ( Symbol.Ask < (NewIndicator, per, 38,2))
ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "bot", StopLoss, TakeProfit);
Can't say without seeing the indicator code!
@Shares4UsDevelopment
PanagiotisCharalampous
13 Nov 2020, 15:51
Hi samuel.jus.cornelio,
The code you posted doesn't make much sense to me. I am not sure I can help you with this.
Best Regards,
Panagiotis
@PanagiotisCharalampous
samuel.jus.cornelio
13 Nov 2020, 15:56
RE:
PanagiotisCharalampous said:
Hi samuel.jus.cornelio,
The code you posted doesn't make much sense to me. I am not sure I can help you with this.
Best Regards,
Panagiotis
Hi Pani. My question is: How can I place a condition for the trade based on the customized indicator? More specifically,
when the price is below the uptrend line, the bot makes a buy trade
could you kindly give me an example of how this can be done?
@samuel.jus.cornelio
samuel.jus.cornelio
13 Nov 2020, 16:06
( Updated at: 21 Dec 2023, 09:22 )
RE:
PanagiotisCharalampous said:
Hi samuel.jus.cornelio,
The code you posted doesn't make much sense to me. I am not sure I can help you with this.
Best Regards,
Panagiotis
As we can see in the image, the price is below the high line of the indicator. Soon after the price goes up. My question is: how can I place a condition in my bot, so that as soon as the price is below the high trend line of the indicator, the Bot makes a buy trade?
@samuel.jus.cornelio
PanagiotisCharalampous
13 Nov 2020, 16:14
Hi samuel.jus.cornelio,
The indicator has a sign output.
[Output("_forIndicators", Color = Colors.Gray, PlotType = PlotType.DiscontinuousLine)]
public IndicatorDataSeries sign { get; set; }
You should be checking if the last value of the sign output is above or below the bid price and place the trade accordingly
Best Regards,
Panagiotis
@PanagiotisCharalampous
samuel.jus.cornelio
16 Nov 2020, 15:00
RE:
PanagiotisCharalampous said:
Hi samuel.jus.cornelio,
The indicator has a sign output.
[Output("_forIndicators", Color = Colors.Gray, PlotType = PlotType.DiscontinuousLine)] public IndicatorDataSeries sign { get; set; }
You should be checking if the last value of the sign output is above or below the bid price and place the trade accordingly
Best Regards,
Panagiotis
Hi Pani, thank you so much for your tips However I did not understand how to program the condition. Could you kindly give me an example of how to do what you said? Thank you so much Pani, you are the best
@samuel.jus.cornelio
samuel.jus.cornelio
20 Nov 2020, 04:31
RE:
PanagiotisCharalampous said:
Hi samuel.jus.cornelio,
The indicator has a sign output.
[Output("_forIndicators", Color = Colors.Gray, PlotType = PlotType.DiscontinuousLine)] public IndicatorDataSeries sign { get; set; }
You should be checking if the last value of the sign output is above or below the bid price and place the trade accordingly
Best Regards,
Panagiotis
Pani, I tried several ways to create the code, but I couldn't, I'm still waiting for an example of how to program the condition
thank you very much for your attention
@samuel.jus.cornelio
PanagiotisCharalampous
20 Nov 2020, 09:52
Hi samuel.jus.cornelio,
I am not sure what do you need exactly. If you need the if statement, then it would look something like
if (sign.LastValue(1) > Symbol.Bid)
.
.
.
.
.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
09 Nov 2020, 09:21
Hi samuel.jus.cornelio,
Here is how to reference a custom indicator.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous