
Topics
Replies
jeex
11 Dec 2013, 11:38
RE: Time Shift Bug
unjeffer said:
I tried to check if the values were NaN but they are actually just wrong. I think they are just older than how they should be, probably the indicator is not updated on every candle so the value of the bands at the last index turns to be an older value.
Each symbol and marketseries needs its own index. See the solution of my problem here. Maybe this works for your algo as well.
/forum/calgo-support/2069?page=1#7
@jeex
jeex
11 Dec 2013, 11:36
RE:
Spotware said:
You can try this on Spotware cAlgo. The method will be available in the next release.
Fixed it by calculating the index-difference:
_XYZindexShift = MarketSeries.Close.Count - _xyz.Close.Count;
And later on use the same indexShift to get the right index.
Thanks for the tip.
@jeex
jeex
11 Dec 2013, 10:24
RE: No such method
Spotware said:
You need to translate the index from one series, the one of the chart, to the another. There is a method GetIndexByExactTime
var indexXyz = xyz.OpenTime.GetIndexByExactTime(MarketSeries.OpenTime.LastValue); Result[index] = xyz.Close[indexXyz];
It sais there is no method by the name of GetIndexByExactTime...
@jeex
jeex
11 Dec 2013, 10:16
RE:
Spotware said:
You need to translate the index from one series, the one of the chart, to the another. There is a method GetIndexByExactTime
var indexXyz = xyz.OpenTime.GetIndexByExactTime(MarketSeries.OpenTime.LastValue); Result[index] = xyz.Close[indexXyz];
Thanks. I'll give it a try.
@jeex
jeex
10 Dec 2013, 21:47
Same BUG?
Look at /forum/calgo-support/2069?page=1#2
Looks like the same bug. For the smallest timeframes 1m to 3m things are OK, for week and month also.
Test the return values of your indicators in the robot. They probably are NaN. As BB calculates averages, the values of BB are wrong as they are partially based on NaN-values.
@jeex
jeex
10 Dec 2013, 20:16
Multi Symbol
i forgot to mention: it is an indicator based on more than one symbol.
[Output("Main")] public IndicatorDataSeries Result { get; set; } MarketSeries xyz; protected override void Initialize() { xyz = MarketData.GetSeries("USDJPY", MarketSeries.TimeFrame); } public override void Calculate(int index) { Result[index] = xyz.Close[index]; }
@jeex
jeex
10 Dec 2013, 20:05
RE: Templates and trendlines
Ztop said:
Just so you know. Having something like that cuts my work time down dramatically. It reduces my work time by 2/3rds. When you plot a ton of charts that saves a significant amount of time.
Other than that I love your platform. Especially the web platform.
I can watch a ton of charts on chrome by using revolver add on. It rotates through each open chart with a 5 to 15 second intervals.
So you can use two monitors to do what others use a ton of monitors for.
Now that is a useful tip.
Would you happen to know such an add on o=for Firefox as well?
@jeex
jeex
05 Dec 2013, 10:31
Just help the poor bugger
As not every trader is a potential programmer, let's just help marafi5: First put this method just beneath the OnTick(){ } method.
private void closeWhenPos() { double profit = 0; // first make a sum of all the open trades' profits foreach (Position p in Account.Positions) profit += p.GrossProfit; // when profit is negative, we're done if (profit <= 0) return; // otherwise profit > 0 so close all pending orders foreach (PendingOrder o in Account.PendingOrders) Trade.DeletePendingOrder(o); // then stop the robot Stop(); }
Then put the line closeWhenPos(); into you ontick method.
protected override void OnTick() { closeWhenPos(); }
Start the Robot on whatever pair you want - the pair does not matter in this case - and as soon as the total profit of open positions > 0, the pending orders will be closed. That could be immediate, or after hours of waiting.
I use a similar bot to close all positions when my daily (or weekly) target is met:
private void closeWhenTarget(double target) { double profit = 0; // first make a sum of all the open trades' profits foreach (Position p in Account.Positions) profit += p.GrossProfit; // when profit is negative, we're done if (profit < target) return; // otherwise profit > 0 so close all pending orders foreach (PendingOrder o in Account.PendingOrders) Trade.DeletePendingOrder(o); // and close all open positions foreach (Position p in Account.Positions) Trade.Close(p); // then stop the robot Stop(); }
Where the variable target is set by a parameter.
Hoped this helps you out on your quest.
@jeex
jeex
12 Dec 2013, 13:20
LastValue also works
I now sync the different timeframes and symbols using the function Spotware provided as a workaround:
And to sync the different timeframes and symbols i start the method Calculate with:
Within the indicator you always calculate on [index].
Within the robot you can use .LastValue and above method works fine.
@jeex