Topics
Replies
VEI5S6C4OUNT0
31 Oct 2023, 03:29
RE: Bug in History/HistoricalTrade
firemyst said:
Have you written anything to the logs or confirmed that the HIST object actually has data and isn't null?
var HIST = History.OrderByDescending ( trade => trade.ClosingTime ) .Take ( 1 ) ;
Yes I tried adding an ExecuteMarketOrder (…….. as part of OnStart and still no trades after that one , it just does nothing.
@VEI5S6C4OUNT0
VEI5S6C4OUNT0
01 Jun 2023, 09:55
Multible Time frames ?
when I was playing with Wiliams Wild Smooth I found that by using simple math it can show what would be on other time frames
For example Use a Simple MA and times by up to the next time frame requiered
1M chart with 15M results over lay like say you want to see a Moving avarage of 21p on a 15m and show this on the 1m
Then set the SMA to 315p ( 21 x 15 = 315 )
there is an indicator that shows the other times as bars but I did not like it as it is just Highs and Lows that I can all ready see with multible charts and monitors.
@VEI5S6C4OUNT0
VEI5S6C4OUNT0
15 Feb 2023, 08:57
RE:
jczheng198508 said:
Yes this should not be part of the trade history and does not help with understanding some trades but then without it you would see gaps in the history and then have to chase up why... so I would say it should be an option at least.
@VEI5S6C4OUNT0
VEI5S6C4OUNT0
15 Feb 2023, 08:52
RE: You need to moderate the forums. The spam and scams are becoming ridiculous.
shane.scott.pub said:
There are people straight-up spamming the boards so that google can crawl their product names in forum posts.
For example, this is one of many posts on the CBot forum
Alpilean is a weight reduction pill that assists you with consuming fat by focusing on your internal heat level. It works by expanding digestion and controlling your....
Etc
And nothing seems to be done. To be politically correct there is no dislike button and they know it. There is also no way to report a post, and they know it. They are laughing and it will get worse. Also, there are people trying to initiate private sales in the algorithm section. It's fine to sell something on the site but trying to avoid moderation by posting private details and trying to solicit payment that way is crazy and so brazen that I have rarely seen it online on reputable sites. I know that like any good coder, you guys probably don't care much about the details of sales and customer relations but this can make or break you. If people get scammed or can't find info because it's clogged with more garbage than genuine responses they will go elsewhere. Mt5 marketplace is a good example of a well-regulated customer space. Also, like Mt5 it should be accessible only from the app. You want to minimize your attack surface. Getting people used to downloading EAs from websites is not a good thing(even if it's yours to start with). For obvious reasons, mainly that it opens the doors for unregulated persons to offer the same thing on their sites. From a business and security standpoint that would be very bad.
Thanks for listening to the public.
I love the product and want it to stay the best and get even better.
I don't know why this has been going on for so long.... Hello , Moderators, is anyone there ???
@VEI5S6C4OUNT0
VEI5S6C4OUNT0
15 Feb 2023, 08:50
RE:
allan.mn said:
This is a suggestion to add the option of opening trades with percentage of account as opposed to only having lot and volume options. Example, being able to open a trade with 2%,5%,10% of account.
this a code I made in a XAUUSD bot that backtested well as a account optimiser sadly the bot its self was not a good one but the position size was great
[Parameter("%", Group = "What", DefaultValue = 3, MinValue = 0.1, Step = 1, MaxValue = 10)]
public double Q { get; set; }
var volumeInUnits = Symbol.NormalizeVolumeInUnits((Account.Balance * (Q / 2000)), RoundingMode.Down);
Here is the Full bot if anyone wants to use parts of it or mod it what ever..
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class StochBot2 : Robot
{
[Parameter("Open Day", Group = "When", DefaultValue = DayOfWeek.Monday)]
public DayOfWeek OD { get; set; }
[Parameter("Close Day", Group = "When", DefaultValue = DayOfWeek.Friday)]
public DayOfWeek CD { get; set; }
[Parameter("Start Hour", Group = "When", DefaultValue = 7.0, Step = 1)] //UTC (LONDON) Summer Time March to October set to 6:00hrs
public double SrT { get; set; }
[Parameter("Stop Hour", Group = "When", DefaultValue = 17.0, Step = 1)] //UTC (LONDON) Summer Time March to October set to 16:00hrs
public double SpT { get; set; }
[Parameter("%", Group = "What", DefaultValue = 3, MinValue = 0.1, Step = 1, MaxValue = 10)]
public double Q { get; set; }
[Parameter("Stop", Group = "What", DefaultValue = 2320, MinValue = 0, Step = 10)]
public double SL { get; set; }
[Parameter("Take", Group = "What", DefaultValue = 180, MinValue = 0, Step = 10)]
public double TP { get; set; }
[Parameter("Include Trailing Stop", Group = "What", DefaultValue = false)]
public bool IncludeTrailingStopch { get; set; }
[Parameter("Trailing Stop Trigger (pips)", Group = "What", DefaultValue = 110)]
public double TrailingStopTriggerch { get; set; }
[Parameter("Trailing Stop Step (pips)", Group = "What", DefaultValue = 10)]
public double TrailingStopStep { get; set; }
[Parameter("K Periods", Group = "How", DefaultValue = 68)]
public int KP { get; set; }
[Parameter("K Slowing", Group = "How", DefaultValue = 68)]
public int KS { get; set; }
[Parameter("D Periods", Group = "How", DefaultValue = 16)]
public int DP { get; set; }
[Parameter("MA", Group = "how",DefaultValue = 142)]
public int MA {get;set;}
private MovingAverage MA1;
private StochasticOscillator STC;
private const string labels = "StochBOT";
private const string labelb = "StochBOT";
protected override void OnStart()
{
STC = Indicators.StochasticOscillator(KP,KS,DP,MovingAverageType.Simple);
MA1 = Indicators.MovingAverage(Bars.ClosePrices,MA,MovingAverageType.Simple);
}
protected override void OnBar()
{
var sellPositions = Positions.FindAll(labels, SymbolName, TradeType.Sell);
var buyPositions = Positions.FindAll(labelb, SymbolName, TradeType.Buy);
var MAV= MA1.Result.Last(1);
var DAY = Server.Time.DayOfWeek;
var TIMENOW = Server.Time.TimeOfDay.TotalHours;
if (DAY > OD && DAY < CD)
{
if (TIMENOW > SrT && TIMENOW < SpT)
if (STC.PercentK.Last(1)<60&&STC.PercentK.Last(2)<STC.PercentD.Last(2)&&STC.PercentK.Last(1)>STC.PercentD.Last(1)&& Bars.ClosePrices.Last(1)>MAV)
{
Open(TradeType.Buy);
}
else if (STC.PercentK.Last(1)>40&&STC.PercentK.Last(2)>STC.PercentD.Last(2)&&STC.PercentK.Last(1)<STC.PercentD.Last(1)&& Bars.ClosePrices.Last(1)<MAV)
{
Open(TradeType.Sell);
}
}
if (IncludeTrailingStopch)
{
foreach (Position position in sellPositions)
{
double distance = position.EntryPrice - Symbol.Ask;
if (distance < TrailingStopTriggerch * Symbol.PipSize)
continue;
double newStopLossPrice = Symbol.Ask + TrailingStopStep * Symbol.PipSize;
if (position.StopLoss == null || newStopLossPrice < position.StopLoss)
{
ModifyPosition(position, newStopLossPrice, position.TakeProfit);
}
}
foreach (Position position in buyPositions)
{
double distance = Symbol.Bid - position.EntryPrice;
if (distance < TrailingStopTriggerch * Symbol.PipSize)
continue;
double newStopLossPrice = Symbol.Bid - TrailingStopStep * Symbol.PipSize;
if (position.StopLoss == null || newStopLossPrice > position.StopLoss)
{
ModifyPosition(position, newStopLossPrice, position.TakeProfit);
}
}
}
}
private void Open(TradeType tradeType)
{
var position = Positions.Find("StochBOT", SymbolName, tradeType);
var volumeInUnits = Symbol.NormalizeVolumeInUnits((Account.Balance * (Q / 2000)), RoundingMode.Down);
if (position==null)
ExecuteMarketOrder(tradeType, SymbolName, volumeInUnits, "StochBOT",SL,TP);
if (Positions.Count < 2)
foreach (var trade in History.OrderByDescending(trade => trade.ClosingTime).Take(1))
if (trade.NetProfit > 0)
ExecuteMarketOrder(tradeType, SymbolName, volumeInUnits*2, "StochBOT",SL,TP*1.2);
}
}
}
@VEI5S6C4OUNT0
VEI5S6C4OUNT0
15 Feb 2023, 08:43
RE: So simple yet so hard to find....
yaqeenmnoor said:
Hello, I would like to give a suggestion to add a risk reward ratio feature like the one in TradingView, Long/Short Position. When cTrader has this tool, it can be said that cTrader is ahead of TradingView. Maybe my suggestion has some similarities with the suggestion of other traders.
And this should be intergrated with the quick trade buttons for strait up possition placment
ie; click Q T button / window pops up/ drag RR sl,tp adjust / and click confirm.
Maybe someone could make a bot/indicator for this, I would but I don't know enough about c# yet...
@VEI5S6C4OUNT0
VEI5S6C4OUNT0
27 Dec 2022, 21:09
RE:
I found that with my EMA bot I am working on, I test it using Tick Data but the bot is looking at OnBar situations.
When looking at Moving Average Crossover I have it set to at least 1 previous bar as even if I was using 1hr timeframe the Ticks would be forming cross situations constantly.
The Tick data will give an live spread type of testing but the bars give a value as last closed prices ....
I would make sure this is part of the logic and then let it run on a DEMO account to see if it acts as expected ?
examle.....
[Parameter("MA Previous Bars", Group = "How", DefaultValue = 2,Step = 1)]
public int MABars { get; set; }
[Parameter("MA Previous Trend Bars", Group = "How", DefaultValue = 2,Step = 1)]
public int MATBars { get; set; }
var currentTrendMa = i_MA_trend.Result.Last(1);
var currentSlowMa = i_MA_slow.Result.Last(1);
var currentFastMa = i_MA_fast.Result.Last(1);
var previousTrendMa = i_MA_trend.Result.Last(MATBars);
var previousFastMa = i_MA_fast.Result.Last(MABars);
@VEI5S6C4OUNT0
VEI5S6C4OUNT0
31 Oct 2023, 05:56 ( Updated at: 31 Oct 2023, 07:02 )
RE: RE: RE: Bug in History/HistoricalTrade
firemyst said:
I see what you mean , as the log show bot>started and bot >stopped at the end of a back test but no explanation as what is happening , I'll try that and see what happens.
So here is what I did
protected override void OnStart ( )
{
fastMa = Indicators.MovingAverage ( Bars.ClosePrices , FPs , MovingAverageType.WilderSmoothing ) ;
slowMa = Indicators.MovingAverage ( Bars.ClosePrices , SPs , MovingAverageType.WilderSmoothing ) ;
megaMa = Indicators.MovingAverage ( Bars.ClosePrices , MPs , MovingAverageType.WilderSmoothing ) ;
Print("Bot OnStart");
}
protected override void OnBar ( )
{Print("Bot OnBar");
var HIST = History.OrderByDescending ( trade => trade.ClosingTime ) .Take ( 1 ) ; // <<<<<
var Units = Symbol.NormalizeVolumeInUnits ( Q * Account.Balance , RoundingMode.Down ) ;
var cFMa = fastMa.Result.Last ( 1 ) ;
var cSMa = slowMa.Result.Last ( 1 ) ;
var cMMa = megaMa.Result.Last ( 1 ) ;
var pFMa = fastMa.Result.Last ( 2 ) ;
var pSMa = slowMa.Result.Last ( 2 ) ;
var MaxPos2 = MaxPos * 2 ;
var MaxPos1 = MaxPos * 1 ;
var PC = Positions.Count ;
var TIMENOW = Server.Time.TimeOfDay.TotalHours ;
{Print("TIMENOW Checking Time...");
if ( TIMENOW < SR || TIMENOW > SP )
{Print ("Time Check False");}
if ( TIMENOW > SR && TIMENOW < SP )
{Print("Time Check True");{
foreach ( var trade in HIST ) // <<<<<
{Print("HIST Ck");{
if ( trade == null || trade.NetProfit < 0 ) // <<<<<
{Print("Trade is Null or NetPro Less Than Ck True");{
if ( cSMa < cMMa && cFMa > cSMa && pFMa < pSMa && PC > MaxPos1 && PC < MaxPos2 )
{Print("MA Ck - E M O Bx1");{
ExecuteMarketOrder ( TradeType.Buy , SymbolName , Units , lab , SL , TP ) ;
}
}
if ( cSMa > cMMa && cFMa < cSMa && pFMa > pSMa && PC > MaxPos1 && PC < MaxPos2 )
{Print("MA Ck - E M O Sx1");{
ExecuteMarketOrder ( TradeType.Sell , SymbolName , Units , lab , SL , TP ) ;
}
}
}
}
else if ( trade != null && trade.NetProfit > 0 ) // <<<<<
{Print("Trade is Null Ck False and NetPro More Than Ck True");{
if ( cSMa < cMMa && cFMa > cSMa && pFMa < pSMa && PC < MaxPos1 )
{Print("MA Ck - E M O Bx2");{
ExecuteMarketOrder ( TradeType.Buy , SymbolName , Units * 2 , lab , SL , TP ) ;
}}
if ( cSMa > cMMa && cFMa < cSMa && pFMa > pSMa && PC < MaxPos1 )
{Print("MA Ck - E M O Sx2");}
ExecuteMarketOrder ( TradeType.Sell , SymbolName , Units * 2 , lab , SL , TP ) ;
}}}
}
}
}
}
}
protected override void OnStop()
{Print ("Bot OnStop");}
}
}
It can check the TIMENOW and prints “Time Check True” or “Time Check False”
and the next log is “Bot OnBar” again so it has a problem with the foreach statement ???
@VEI5S6C4OUNT0