code with Chaikin oscillator 
September 28th, 2015, 06:26 PM  #1 (permalink) 
Trading Apprentice
Venice + Italy
Futures Experience: None
Platform: MultiCharts
Favorite Futures: Forex
Posts: 2 since Sep 2015
Thanks: 0 given,
0
received

code with Chaikin oscillator
Hello!
i'm a female student and i'm preparing my thesis for the university. The professor asked me to write a code in multicharts. The purpose is to create a system with management technique of opening and closing operations, and in particular I have to study the divergences and therefore I need:  an array in which, for the bearish position, there are 2 maximum and 1 minimum respectively surrounded by two lower maximum and two minimum respectively;  the condition that if the max2> max1 and (max2 indicator)<(max1 indicator ) * then i go short if last price is below the minimum * and I have a stop loss above the max2, once opened the position;  the indicator i have to use is Chaikin Oscillator I tryed to write this code but i need a correction of it. i attack it here if someone can help me: // ARRAY [IntrabarOrderGeneration = true] variables: m(1), j(0), n(0), dati[m,2] ; array: int A_MAX[m][n]; while m <> number_row(dati) begin while j = 0 m=m+1; if (dati[m,2]> dati[(m1),2] AND dati[(m1),2)> dati[(m2),2] AND dati[m,2]> dati[(m+1),2] AND dati[(m+1),2]> dati[(m+2),2]) then begin n = n+1; A_MAX[1][n] = dati[m;2]; j = 1; end; while j = 0 m=m+1; if (dati[m,2]< dati[(m1),2] AND dati[(m1),2]< dati[(m2),2] AND dati[m,2]< dati[(m+1),2] AND dati[(m+1),2]< dati[(m+2),2]) then begin n = n+1; A_MAX[2][n] = dati[m;2]; j = 1; end; while j = 0 m=m+1; if (dati(m,2]> dati[(m1),2] AND dati[(m1),2]> dati[(m2),2] AND dati[m,2]> dati[(m+1),2] AND dati[(m+1),2]> dati[(m+2),2]) then begin n = n+1; A_MAX[3][n] = dati[m;2]; j = 1; end; end // CODE INPUTS: MYVOL(VOLUME), FAST(3), SLOW(10); PLOT1(CHAIKINOSC(MYVOL, FAST, SLOW) , "CHAIKIN" ); PLOT2(0 ,"ZERO"); {ALERT CRITERIA} IF A_MAX[3][n]>A_MAX[1][n] AND CHAIKINOSC(A_MAX[1][n])>CHAIKINOSC(A_MAX[3][n]) THEN BEGIN SELLSHORT NEXT BAR AT CLOSE(A_MAX[2][n]); ALERT("A BEARISH DIVERGENCE HAS BEEN DETECTED"); END; ELSE IF A_MIN[3][n]>A_MIN[1][n] AND CHAIKINOSC(A_MIN[1][n])>CHAIKINOSC(A_MIN[3][n]) THEN BEGIN BUY NEXT BAR AT CLOSE(A_MIN[2][n]); ALERT("A BULLISH DIVERGENCE HAS BEEN DETECTED"); END Many many thanks to all can help me! Last edited by streghetta; September 28th, 2015 at 07:06 PM. 