Topics
17 Dec 2013, 15:49
 3197
 5
01 Nov 2013, 02:45
 6965
 25
09 Oct 2013, 22:05
 3853
 6
25 Sep 2013, 03:36
 3496
 8
23 Apr 2013, 20:45
 6013
 4
22 Feb 2013, 01:23
 3520
 3
06 Feb 2013, 16:38
 3437
 2
15 Jan 2013, 20:41
 3432
 3
26 Dec 2012, 11:17
 3075
 3
Replies

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

supafly
24 Apr 2013, 14:00

Thank you very much for this detailed explanation. It has certainly cleared up a few misinterpretations.


@supafly

supafly
23 Apr 2013, 23:00

Also how does "var = MarketSeries.Close.Count - 2;" differ from "var = MarketSeries.Close[MarketSeries.Close.Count - 2]" ?


@supafly

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
25 Jan 2013, 13:33

RE:

Admin,

I will use the print statement and review the results. Thanks for your help. Much apppreciated.

 


@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, 18:20

So what you are saying is that count -1 represents the last candlestick which is not completed?


@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:56

Also, I have modified the command below to 10000 which is the minimum allowed volume but again there is no result.

Trade.CreateSellMarketOrder(Symbol, 1000);

@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, 20:18

RE: RE:

Hi Martin,

Can you let us know what type of analysis you used to achieve such results?

For example fundamental analysis, technical analysis, quantitative finance, behavioural finance ect. ect.

Thanks


@supafly

supafly
17 Jan 2013, 19:24

RE:
admin said:

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:
rcc25 said:

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:
hichem said:
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