# Easylanguage code problem

#### ponex

##### Member

Example long

When sma60> sma90 and sma60> sma150 and sma90> sma150 we will take as maximum reference the maximum of the 30 bars before the cross.

If then this maximum will be broken upwards we will have long signal.

I have verified that it does not respect the maximum constraint of the 30 candles before the cross up.

What's wrong with the formula ??

thank you.

All help graciously received and appreciated.

luca

in simple terms:

When the averages cross up, the cross is the condition that if it is true we will have buy signal at the top when it is exceeds the previous 30 candles crossing.

code:

Input: average(c), len(60), len1(90),len2(150);

condition1= len>len1 and len>len2 and len1>len2 ;

condition2=len<len1 and len<len2 and len1<len2;

condition3=H crosses over Highest(h,30);

condition4=L crosses under Lowest(l,30);

if condition1 and condition3 then buy next bar at market;

if condition2 and condition4 then sellshort next bar at market;

Last edited:

#### options-george

##### Active member

They are both websites with a huge amount of free content on EL coding.
I've been using those sites in the past few weeks and they have been very helpful.

Good luck.

#### iq200

##### Active member

Example long

When sma60> sma90 and sma60> sma150 and sma90> sma150 we will take as maximum reference the maximum of the 30 bars before the cross.

If then this maximum will be broken upwards we will have long signal.

I have verified that it does not respect the maximum constraint of the 30 candles before the cross up.

What's wrong with the formula ??

thank you.

All help graciously received and appreciated.

luca

in simple terms:

When the averages cross up, the cross is the condition that if it is true we will have buy signal at the top when it is exceeds the previous 30 candles crossing.

code:

Input: average(c), len(60), len1(90),len2(150);

condition1= len>len1 and len>len2 and len1>len2 ;

condition2=len<len1 and len<len2 and len1<len2;

condition3=H crosses over Highest(h,30);

condition4=L crosses under Lowest(l,30);

if condition1 and condition3 then buy next bar at market;

if condition2 and condition4 then sellshort next bar at market;

what are sma60, sma90 and sma150? Where are you calculating these? If they are sma values, you need to calculate these. Currently you are just declaring lengths and comparing these and these comparisons are always going to be true.

I assume you want something like the following (not tested):

Input: len(60), len1(90),len2(150);
Variables: sma60(0), sma90(0), sma150(0);

sma60 = average(close, len);
sma90 = average(close, len1);
sma150 = average(close, len2);

condition1= sma60>sma90 and sma90>sma150 and sma60>sma150;
condition2= sma60<sma90 and sma90<sma150 and sma60<sma150;

condition3=H crosses over Highest(h,30);

condition4=L crosses under Lowest(l,30);

if condition1 and condition3 then buy next bar at market;

if condition2 and condition4 then sellshort next bar at market;

Last edited: