Easy Language system help Needed

lancenkeisha

Newbie
Messages
5
Likes
0
Hello

I am new to coding in easy language and I need some help to complete the system. The system is to place an arrow on the chart in the direction of the trade based on

1) Bull
Price crossing above a SMA (9) By 10pips ( at Close )
MACD in a Bull Mode
RSI Greater 50

and the reverse for the Bear trade

Please see the code that I am having Problems with Below

Inputs:
FastLength( 12 ),
SlowLength( 26 ),
MACDLength( 9 ) ,
Price( Close ),
Length( 14 ),
OverSold( 30 ),
MA_Length( 60 );



variables:
var0( 0 ),
var1( 0 ),
var2( 0 ) ,
var3 ( 0 ),
var5 ( 0 );
var0 = MACD( Close, FastLength, SlowLength ) ;
var1 = XAverage( var0, MACDLength ) ;
var2 = var0 - var1 ;


var3 = RSI( Price, Length );



condition1 = FastLength > SlowLength ;

condition2 = var3 > 50;


condition3 = Price >= MA_Length + 10;




if condition1 and condition2 and condition3 then
Buy ( "10point MA Cross" )next bar at market;
 
Before I load it up - can you tell me what the problem is ?

I presume you have this written as a strategy, right ?

Personally, if I were starting from scratch, I'd code it up as a paintbar or a showme first before coding it as a strategy.

One thing I don't understand is this "condition3 = Price >= MA_Length + 10;". You have MA_Length set to 60, so the statement effectively means "condition3 = Close >= 60 + 10"'. That doesn't make much sense.

Cheers

Pete
 
Last edited:
I thought that they could be done in one as I said I am new to Easy Language
Could you tell me where i went wrong in the codes
While I wait I will go and do some more reading on paintbar

Thanks
 
Before I load it up - can you tell me what the problem is ?

I presume you have this written as a strategy, right ?

Personally, if I were starting from scratch, I'd code it up as a paintbar or a showme first before coding it as a strategy.

One thing I don't understand is this "condition3 = Price >= MA_Length + 10;". You have MA_Length set to 60, so the statement effectively means "condition3 = Close >= 60 + 10"'. That doesn't make much sense.

Cheers

Pete


What I am trying to say find is when Price closes 10pips or more above the 60 period Moving average
 
Try this for size...

Inputs: FastLength( 12 ),SlowLength( 26 ),MACDLength( 9 ) ,
Price( Close ),Length( 14 ),OverSold( 30 ),MA_Length( 60 );

variables: AveragePrice(0),MACDLine(0), MACDSignal(0);

MACDLine = MACD( Close, FastLength, SlowLength );
MACDSignal = XAverage( MACDLine, MACDLength );
AveragePrice = Average(Price, MA_Length);

if MACDLine > MACDSignal and RSI( Price, Length ) > 50
and Price >= AveragePrice + 10 then
PlotPB(open,high,low,close,"buybar", blue);

That'll be 50 pence :smart:

Now - to turn this into a strategy we need some exit criteria. Once in - at what point would you like to exit the trade ?

To exit when you no longer have a buy signal you could do this :

Inputs: FastLength( 12 ),SlowLength( 26 ),MACDLength( 9 ) ,Price( Close ),Length( 14 ),OverSold( 30 ),MA_Length( 60 );

variables: AveragePrice(0),MACDLine(0), MACDSignal(0);

MACDLine = MACD( Close, FastLength, SlowLength );
MACDSignal = XAverage( MACDLine, MACDLength );
AveragePrice = Average(Price, MA_Length);

if MACDLine > MACDSignal and RSI( Price, Length ) > 50
and Price >= AveragePrice + 10 then begin
Print(date, ", ", time, ", Buy");
Buy ( "10point MA Cross" )next bar at market;
end
else
Sell( "Long Exit" )next bar at market;
 
Last edited:
Try this for size...



That'll be 50 pence :smart:

Now - to turn this into a strategy we need some exit criteria. Once in - at what point would you like to exit the trade ?

To exit when you no longer have a buy signal you could do this :



Thank you will try this out and give my feed back
 
Top