[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: testing multiple systems simultaneously



PureBytes Links

Trading Reference Links

--- In amibroker@xxxxxxxxxxxxxxx, "Paul Ho" <paul.tsho@xxx> wrote:
>
> Angelo,
> You can, for example, if you want to enter two trades on the same bar
> just sum to size of each system on that bar, and buyprice would be the weighted average of the buyprice of the two systems for that bar
> ie
> size[i] = size1[i] + size2[i];
> Buyprice[i] = (size1[i] * Buyprice1[i] + size2[i] * Buyprice2[i])/size[i];
> I have uploaded a simple example showing you how a simple two system multiplexer can be written. 
> 
> http://www.amibroker.com/library/detail.php?id=1227
> 
> It is not based on your requirements, but nevertheless illustrate how you can pair up sell to their respective buy. It allows only 1 trades per symbol at any one time, same as the default in AB. But you can basically program any rules you want, such as yours. It would however involves sigscalein and sigscaleout as though. But once you understand loop programming, then it shouldnt be a huge problem, just a nice challenge.
> PS. You cant use applystop in designing your system, you have to write stops into the loops directly.
> 
> You will notice that I havent use CBT in this example at all.
> Paul.



Many thanks Paul, 
you are very generous and your code indeed matches Buy and Sell as needed.
Also, your suggestion above regarding multiple trades on the same bar does allow to calculate the total P&L of the test, but the total number of trades (and all statistics calculated on them) will be wrong.

But nevertheless, your code is a very nice departure after all this chatting.

Greetings,

Angelo.

 



------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/