
Topics
Replies
WhiteSage
19 Apr 2015, 22:35
Example provided works, just paste in after the last using statement. For some reason beyond my control my test became un-linked and the class name wasn't changing automatically, sorry about that.
You need to add
using System.Reflection;
And set your AccessRights to FileSystem as reflections requires it.
The one line magic you are looking for is:
Print(this.GetType().Assembly.GetName().Name);
and this will return the name as it is typed in the cAlgo interface.
Hazzah, Wizard stuff.
@WhiteSage
WhiteSage
19 Apr 2015, 19:33
Just be aware if you change the name of your cBot/Indicator but not the class name (in the code) your logs will not represent that new name unless you use typeof(class).Assembly.GetName.Name
@WhiteSage
WhiteSage
19 Apr 2015, 13:42
RE:
WhiteSage said:
You can get the class name which is always the same as the indicator name (without spaces)
Sorry it is not always the same!
@WhiteSage
WhiteSage
19 Apr 2015, 13:19
You can get the class name which is always the same as the indicator name (without spaces)
Type T = typeof(cAlgo.thisRobot); Print(T.Name);
but its kind of redundant as changing the name of a cBot once it is changed away from the default name, doesn't re-factor the class name.
using System.Reflection; namespace cAlgo { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FileSystem)] public class classNamedTest : Robot { [Parameter(DefaultValue = 0.0)] public double Parameter { get; set; } protected override void OnStart() { Type T = typeof(cAlgo.classNamedTest); Print(T.Name + " and " + this.ToString() + " are the same."); Assembly A = T.Assembly; AssemblyName N = A.GetName(); Print(N.Name + " is the indicators name."); } } }
Name of cBot in IDE side bar is 'Indicator Named Test'
Result:
classNamedTest and classNamedTest are the same.
Indicator Named Test is the indicators name.
It would be handy if it was exposed, more so if changing the indicator or cBot name refactored the class name (same as Indicator name but with no spaces etc).
@WhiteSage
WhiteSage
19 Apr 2015, 12:01
Not exactly the answer but relevant:
Volume must be rounded to a suitable amount for trades. Check out Symbol.NormalizeVolume in the reference.
@WhiteSage
WhiteSage
17 Apr 2015, 19:50
I just discovered that during an Optimization the initial length of the marketSeries (and therefore indicators) is MUCH MUCH shorter than a trading window or a Backtest.
Print("Market Length " + MarketSeries.Open.Count);
Optimization: Market Length 122
Back test: Market Length 8157
If you have any indicators that have long MA's uses Min or Max values or has accumulation the results will be different.
@WhiteSage
WhiteSage
17 Apr 2015, 19:34
Under Backtesting and Optimization is a little gear, in there is a pull down menu for 'Data'.
Be sure both are set to the same value (tick data, or 1m) and also be sure both are set to exactly the same start and end dates.
Hopefully that helps.
@WhiteSage
WhiteSage
16 Apr 2015, 11:01
OnBar() is called as a new bar opens I believe, so you will want Result.Last[1], Last[0] is always the current incomplete bar.
@WhiteSage
WhiteSage
16 Apr 2015, 10:57
I'm assuming during a back test that the only symbol stream available is the one selected?
has anyone tested an multi-symbol indicator inside a cBot, is the behavior only limited to back tests?
@WhiteSage
WhiteSage
16 Apr 2015, 10:20
Being able to colour the background would be a feature request for indicators as there is no access to background colour.
You could add this to the vote.spotware.com
@WhiteSage
WhiteSage
16 Apr 2015, 08:42
Curious DateTime min and max don't work. You could use the OpenTime's. Try replacing DateTime's with MarketSeries.OpenTime[0]; and MarketSeries.OpenTime.Last[0];
Or the index based overload. 0 and MarketSeries.Count
@WhiteSage
WhiteSage
16 Apr 2015, 08:34
Visual mode with a speed control and break to visual studio.
Accurate delays with decision making that takes up cpu time would make this tool perfect.
@WhiteSage
WhiteSage
16 Apr 2015, 07:16
Pretty sure c#.net can send an email, maybe HTTP or TCP messages?
That would make a nice code example.
@WhiteSage
WhiteSage
16 Apr 2015, 07:01
Bump for an indicatorDataSeries .Hide .Show .Redraw feature that is callable from cBots!
(eg, myIndicator.Result.Redraw(), would cause an immediate draw of the dataSeries regardless as to whether the calculate/ontick/newbar has finished)
@WhiteSage
WhiteSage
16 Apr 2015, 06:56
This is programmable by the user, check the trailing stop examples on ctdn.com
@WhiteSage
WhiteSage
15 Apr 2015, 18:46
A couple of questions on Indicator behavior:
Is a quick way of clearing an indicators DataSeries, I can't seem to new or NaN it?
I'm also wondering if there is a way to interpolate a Larger time series to a Smaller one that is smoothed out, as opposed to linear lines from point to point? (I tried a few combinations of series and MA's but had no immediate result)
@WhiteSage
WhiteSage
19 Apr 2015, 22:44
@WhiteSage