Easylangage Candle Data

Discussion in 'Strategy Development' started by SlowCarry, Aug 8, 2012.

  1. SlowCarry

    SlowCarry

    Hi,

    I'm hoping that someone would be able to help. I'm trying to get/store the open/close/low/high of a candle that had a trade triggered of it.

    The trades will be triggered of a simple wma cross over but i would like to store that candle data for future use, ie Tp Sl ect.

    Was thinking of something like a tick counter that would increment for every bar after entry bar and then use that to get the value of it. Not sure how to code this. :(

    Thank you,
     
  2. Roughly (I can't test):

    Code:
    Inputs:
    Window(20);
    
    Variables:
    WMAFast(0),
    WMASlow(0),
    CollumnNum(0),
    RowNum(0);
    
    Array: 
    BarData[99,3](0,0); //you can use 1 array or 4 arrays (This is an array with 100 collumns and 4 rows) 
    
    WMAFast = average ( c , window);
    WMASlow = average ( WMAFast , window);
    
    If WMAFast crosses above WMASlow then begin //your long entry rules
    
    o = BarData[CollumnNum, RowNum];      
    h = BarData[CollumnNum, RowNum+1];
    l = BarData[CollumnNum, RowNum+2];
    c = BarData[CollumnNum, RowNum+3];
    
    CollumnNum = CollumnNum +  1;
    
    End;
    
    
     
  3. SlowCarry

    SlowCarry

    Thank you for help, but the issue isn't the execution of the ma. I've write the code for that. The issue more so getting high/low date from the candle of which the trade was executed however may bars back.

    I've tried to use this but from memory i think the issue was that it would read the open/close as the high/low not the actual wicks.
    Code:
    if (count1 = 0 ) then begin
    	if (barssinceentry > 0) then begin
    		count1 = count1 +1;
    			if (barssinceentry > count1) then begin
    				count1 = count1 + 1;
    			end;		
    	end;
    end;
     
  4. I think there are some bar count functions you can use (don't have manual handy). Usually you can reference a bar's O/H/L/C value by using the reference you want such as "H" and the # of the bar in brackets. Have you tried using either "barssinceentry" or "count1" to reference the bar number you want to grab? For example:

    Code:
     h[barssinceentry] //returns the high of the bar 'barssinceentry' bars ago 
    Bar dates are found similarly:
    Code:
     D[10] //returns the date of the bar ten bars ago