LSMA, Polynomial and other Regression with Experts and Indicators - page 11

 

...

This is by far the simplest way to calculate LSMA (the original way to calculate LSMA found out by vinin)

double iLsma(int shift, int LSMAPeriod, int LSMAPrice)

{

double ma1=iMA(NULL,0,LSMAPeriod,0,MODE_SMA ,LSMAPrice,shift);

double ma2=iMA(NULL,0,LSMAPeriod,0,MODE_LWMA,LSMAPrice,shift);

return(3.0*ma2-2.0*ma1);

}

you do not need external indicators

to determine colors (as your intention is) simply compare current LSMA with previous value of LSMA :

  • LSMACurrent > LSMAPrevious: green
  • LSMACurrent < LSMAPrevious: red
  • LSMACurrent = LSMAPrevious: whatever you want (I prefer to keep the previous "color" but I guess you are looking for yellow)

PS : on the picture there are two LSMAs : one is the vinin way of calculating LSMA (the thick line) and the "classical" way of calculating LSMA (the thin red line). So...

regards

mladen

Files:
 

LSMA Direction

mladen:
This is by far the simplest way to calculate LSMA (the original way to calculate LSMA found out by vinin)

double iLsma(int shift, int LSMAPeriod, int LSMAPrice)

{

double ma1=iMA(NULL,0,LSMAPeriod,0,MODE_SMA ,LSMAPrice,shift);

double ma2=iMA(NULL,0,LSMAPeriod,0,MODE_LWMA,LSMAPrice,shift);

return(3.0*ma2-2.0*ma1);

}

you do not need external indicators

to determine colors (as your intention is) simply compare current LSMA with previous value of LSMA :

  • LSMACurrent > LSMAPrevious: green
  • LSMACurrent < LSMAPrevious: red
  • LSMACurrent = LSMAPrevious: whatever you want (I prefer to keep the previous "color" but I guess you are looking for yellow)

PS : on the picture there are two LSMAs : one is the vinin way of calculating LSMA (the thick line) and the "classical" way of calculating LSMA (the thin red line). So...

regards

mladen

Thanks a lot.

This clarify

Which LSMA is better to use for my EA, the classical or the Vinin?

 
mladen:
This is by far the simplest way to calculate LSMA (the original way to calculate LSMA found out by vinin)

double iLsma(int shift, int LSMAPeriod, int LSMAPrice)

{

double ma1=iMA(NULL,0,LSMAPeriod,0,MODE_SMA ,LSMAPrice,shift);

double ma2=iMA(NULL,0,LSMAPeriod,0,MODE_LWMA,LSMAPrice,shift);

return(3.0*ma2-2.0*ma1);

}

you do not need external indicators

to determine colors (as your intention is) simply compare current LSMA with previous value of LSMA :

  • LSMACurrent > LSMAPrevious: green
  • LSMACurrent < LSMAPrevious: red
  • LSMACurrent = LSMAPrevious: whatever you want (I prefer to keep the previous "color" but I guess you are looking for yellow)

PS : on the picture there are two LSMAs : one is the vinin way of calculating LSMA (the thick line) and the "classical" way of calculating LSMA (the thin red line). So...

regards

mladen

mLaden,

Nice code.

There is a minor problem though.

When the calculation is done there is the possibility that the yellow line will not appear when it should.

This code makes sure the calculation if done to the proper number of digits to avoid compares beyond the pip level.

NormalizeDouble also works but the code used is faster.

I also added TimeFrame and moved shift to the last parameter position.

double iLsma(int TimeFrame, int LSMAPeriod, int LSMAPrice,int shift)

{

double wt;

double ma1=iMA(NULL,TimeFrame,LSMAPeriod,0,MODE_SMA ,LSMAPrice,shift);

double ma2=iMA(NULL,TimeFrame,LSMAPeriod,0,MODE_LWMA,LSMAPrice,shift);

wt = MathFloor((3.0*ma2-2.0*ma1)/Point)*Point;

return(wt);

}

Robert

 

You are right about the "yellow line" : without rounding the result of lsma, "yellow line" is going to show much, much rarer than when rounded.

Now the usage of the "yellow line" may vary : I, for example, am a "trend chaser" not a "reversal chaser" and I personally prefer the "no yellow line" approach (meaning - inheriting previous values in cases when current = previous, and not assigning "third state" value) since I am looking for inertia, not a warning signs of reversal.

So, that code (for which I really can not take credit since that way of calculating lsma was invented by vinin, all I did is some cosmetics) is just a lsma calculating function, nothing else (no "inheriting way" coded in it either)

regards

mladen

MrPip:
mLaden,

Nice code.

There is a minor problem though.

When the calculation is done there is the possibility that the yellow line will not appear when it should.

This code makes sure the calculation if done to the proper number of digits to avoid compares beyond the pip level.

NormalizeDouble also works but the code used is faster.

I also added TimeFrame and moved shift to the last parameter position.

double iLsma(int TimeFrame, int LSMAPeriod, int LSMAPrice,int shift)

{

double wt;

double ma1=iMA(NULL,TimeFrame,LSMAPeriod,0,MODE_SMA ,LSMAPrice,shift);

double ma2=iMA(NULL,TimeFrame,LSMAPeriod,0,MODE_LWMA,LSMAPrice,shift);

wt = MathFloor((3.0*ma2-2.0*ma1)/Point)*Point;

return(wt);

}

Robert
 
Baba_master:
hi friends

here im sharing one of my indis (SLSMA) lets see if its useful

the result below shows the behavior of the indicator (settings not optimized) in 2008 with (smoothed ma 55 Chanel) as a filter (very quick ea).

try out different settings and compare it with LSMA,

khaste nabashid.

Well sir, it says "this version has been expired. Please look for update"

Could you post these indicators again...

have a good day

 

Is there anybody to post the indicators? or updated one? have a good day

 
bibbob:
Is there anybody to post the indicators? or updated one? have a good day

That isd why i HATE posting of ex4.

There is no way to remove the expiration date with out the source code.

BTW, I am still trading the GBPJPY with the same method posted from last year, May to July, and have been very successful. Is anyone trading other pairs with the same method?

Robert

 

Hi this EA has big potential i dont know why know one test it?!

Regards

 

a great one there thanks i realy love it it work perfectly well

i like the indicators it work well this is what i want

 

LSMA W 7/16 Daily

Mr PIPS

I saw the indictor/EA this AM on a Yahoo forum. The one I saw had the lines showing the cross over. I may be missing something but I don't see it hear. Is it possible to get the one that I saw on the forum.

Thank you for all you do, The forum was one of the best I have attended

Thanks

sentaco:
This EA looks really good Regards
Reason: