読み取り専用

フォーラムは現在、読み取り専用のアーカイブとなっています。.

バグ報告やプラットフォームに関する質問はこちら → [email protected]

私たちのコミュニティはDiscordとYouTubeで活動しています。ぜひ参加してください!

ご参加ください Discord YouTube

LWMA indicator is different from MC

1件の返信

ビンシル

購読者、bbp_participant、顧客、コミュニティ、sq-ultimate、17件の返信。.

プロフィールを表示

5年前 #271099

こんにちは

I have a MC strategy, I need to transplant it to Algowizard an retest ,optimize.

So MC strategy code is :

inputs:Len1(14),Len2(80),sb(40);

variables:var1(0);

var1=(Average(close,Len1)-wAverage(close,Len2));

if Average(var1,sb) crosses over 0 then Buy  Next Bar at market;

if Average(var1,sb) crosses under 0 then Sell Short Next Bar at market;

質問:

1. I found that waverage function in MC is different from LWMA indicator in SQ

MC Waerage:

入力:

PriceValue( numericseries ),

Len( numericsimple ) ;

variables:

var0( 0 ),

var1( 0 ) ;

var0 = 0 ;

for Value1 = 0 to Len – 1

begin

var0 = var0 + ( Len – Value1 ) * PriceValue[Value1] ;

end ;

var1 = ( Len + 1 ) * Len * .5 ;

WAverage = var0 / var1 ;

 

SQ LWMA indicator:

private void calculateLWMA(int CurrentBar, double newValue) {
int max = Math.min(Period, CurrentBar);
int multiplier = Period;
int divider = 0;
double sum = 0;

for(int a=0; a<max; a++){
divider += multiplier;
sum += buffer[a] * (multiplier–);
}

currentValue = sum / divider;
}

divider looks like Period*Period. So is differt from MC.  Whichi is better? Or no better, just be consistent between SQ and MC?

2. When I code average(var1,sb) crosses over 0 in Trading signals, How can I code? Because there are no “variable5” in

“ Compute from” option of average indicator.

So Is it possible to support to add custom variables  in price computed from option ? like period, shift option.

Of course i will try to add custom average function through programing in code editor first.

Thanks  very much

ビン

0

Tomas Matejka

管理者、sq-ultimate、2件の返信.

プロフィールを表示

5年前 #271129

こんにちは,

yes, LWMA seems different from WMA since they supposed to be calculated differently

線形加重移動平均 https://www.investopedia.com/terms/l/linearlyweightedmovingaverage.asp

WMA and others https://www.investopedia.com/ask/answers/071414/whats-difference-between-moving-average-and-weighted-moving-average.asp

You can simply check for two values cross but you always need to store 4 values. Meaning 2 values for Shift = 2 and 2 values for Shift = 1 so you have previous bar values and current bar values you can compare easily.

To check for the cross you simply setup these conditions:

if  Value1atShift2 < Value2atShift2 AND Value1atShift1 > Value2atShift1 – now you have a situation where Value1 crosses above Value2. This way you can setup any “Cross-over” situation …

1

1件の返信を表示中 - 1 - 1件目 (全1件中)