How to put Multiple signals into one system

Hello! Guys,
I need to put 4 MAcross buy signals and 4 MAcross sell signals into one trading system.
So far I've been studying the ScaleIn and ScaleOut theories and google "Multiple Signals in amiborker", and found nothing to help me complete my code. And I have to ask your guys help.
Below is part of my code:

SetTradeDelays(1, 1, 1, 1); 
BuyPrice = Open; 
SellPrice = Open; 
// MAs:
MA2 = MA(C, 2);
MA10 = MA(C, 10); 
MA20 = MA(C, 20);
MA30 = MA(C, 30);
MA40 = MA(C, 40);
// 4 Buy Signals:
Buy1 = Cross(MA2, MA10); // I need to Buy 25% of equity in this Buy signal;
Buy2 = Cross(MA2, MA20); // I need to Buy 25% of equity in this Buy signal;
Buy3 = Cross(MA2, MA30); // I need to Buy 25% of equity in this Buy signal;
Buy4 = Cross(MA2, MA40); // I need to Buy 25% of equity in this Buy signal;

// 4 Sell Signals:
Sell1 = Cross(MA10, MA2); // I need to Sell the position from Buy1 in this sell signal;
Sell2 = Cross(MA20, MA2); // I need to Sell the position from Buy2 in this sell signal;
Sell3 = Cross(MA30, MA2); // I need to Sell the position from Buy3 in this sell signal;
Sell4 = Cross(MA40, MA2); // I need to Sell the position from Buy4 in this sell signal;

// Now How to write the buy and sell code to meet my needs above?

Thank you for your help!

You should study the AFL used to reproduce Larry Connors' TPS strategy. It uses 4 separate entry signals and scales in. You'll find it in the Knowledge Base here.

Scale outs will be very similar to implement. Just remember in Amibroker all the Scale-ins and Scale-outs all happen on the Buy array (assuming a Long only strategy). Ref: https://www.amibroker.com/guide/h_pyramid.html

1 Like