Topics
Replies
supafly
22 Feb 2013, 01:34
I think i spotted the problem, the target price was above the current market price made using the Stop Order to Buy and the modification i made was a target price well below the current market price, hence why i think it executed at current market price. Shouldnt the software prevent that modification instead of execute at the current market price?
@supafly
supafly
29 Jan 2013, 12:51
Hi again admin,
Something has come to mind and I would like to run it by you. You mentioned before in one of my other posts that count -1 represents the current values which are moving when using OnBar() until e.g an hour passes if on the 1h time frame hence finalizing the close price and so forth. So I am assuming that this might be the problem since im using non static values and the robot initializes a second, third ect position from the roughly the same price and time. I would like to know if count -2 works the same way on indicators as it is used on the MarketSeries command? So in other words I use the previous price close with the previous close values created by the indicators instead of relying on the .LastValue command.
Thanks
@supafly
supafly
29 Jan 2013, 12:18
Hi admin,
Im afraid i cannot post or email the code since the IRs do not belong to me. I am confused though why backtesting differs from going live. Do you have any suggestions where the difference/problem might be? As i said before, it all works fine during backtesting.
Thanks
@supafly
supafly
29 Jan 2013, 09:21
During backtesting the algo works fine and only has one position running at a time. If another position is to be opened it means the previous one will or has been closed due to a S/L or T/P or another position in the opposite direction has been open. The buy and sell criteria always include the following in the last if statement to be executed:
ClosePosition();
Sell();
The problem is when I went live yesterday, it kept opening a second position and my code has been taken from examples from the forums and I dont believe its wrong since it works fine during backtesting. What could be the problem? I cannot trust the robot with real money.
Thanks
@supafly
supafly
24 Jan 2013, 18:46
Also, I have another live working algorithm that uses count -1 for a MarketSeries command and moving averages with count -1 and count -2. If my above statement is true, when I tried to modify the algorithm to say -2 instead of -1, the bactesting results were poor compared to the previous backtest results. Again this algorithm uses OnBar().
Thanks
@supafly
supafly
24 Jan 2013, 13:38
Hi Admin,
I have backtested and dropped down to the 1 minute but again no result. If its possible, can you run the above algo and tell me if it works on your system. Im not sure if there is an issue when doing a comparison and both conditions have the same MarketSeries count.
Thanks
@supafly
supafly
23 Jan 2013, 19:42
Admin,
Thanks for taking the time to write the above algo. I have just compared it to my algo and they are very similar in logic and syntax. I am still unable to locate the problem so i compiled your algo to see the outcome and it is giving me the same results which are 0 trades executed, so im not sure what else to do.
If it helps, the only differences are:
private Position position;
protected override void OnBar()
Thanks
@supafly
supafly
17 Jan 2013, 19:24
RE:
The sharpe ratio numbers you have quoted are correct.
It is not possible to backtest using locally stored data. If backtesting takes too long it may be due to the algorithm logic as opposed to the data being received. The time it takes to load the trendbars is not too long normally.There is also no solution at the time being that will enable Matlab functions in cAlgo but there is a possibility that this will be implemented in the future.
Thanks for the info, much appreciated.
@supafly
supafly
16 Jan 2013, 17:35
RE:
hi all
i am new to programing and i need some help please
i need bit of code wchich controls amount of opened positions
i ve made little robot and it works ok but it opens to many orders
i want option to limit them for amount i will set up in robot settings
for example on start it opens two positions and i want open two new positions when previous two are closed
what paremetrs i need and what bit of code
thx
raf
hi rcc25,
not to sure but try this code under OnBar() or under OnTick()
if (Account.Positions.Count < 3)
{
your code
}
@supafly
supafly
30 Dec 2012, 14:08
RE: RE:
supafly said:Are there any books/examples that can help me create my first robot in cAlgo? I am fairly new to programming and only know C#. I have a strong backround in technical analysis and would like to automate/test my strategies. I would be grateful if anyone can provide any suggestions.
Hello,
you can look in there : /docs/lessons
hichem,
thanks for the link, much appreciated.
@supafly
supafly
28 Aug 2013, 00:46
I created two new methods and called those methods from onbar() with the out command in order to create and return values to the variables i declared in onbar(). The code compiles but when i press the build button, it re-arranges parts of my code by taking a portion of code from line x and places it in line y for no reason. Im going to assume that calgo has a bug somewhere since VS2010 does not respond this way.
@supafly