 |
SlowCarry
Registered: Aug 2012
Posts: 2 |
08-08-12 08:25 AM
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,
|
| |
|
Edit/Delete • Quote • Complain |

masterm1ne
Registered: Dec 2009
Posts: 798 |
08-10-12 03:15 PM
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;
|
| |
|
Edit/Delete • Quote • Complain |

SlowCarry
Registered: Aug 2012
Posts: 2 |
08-11-12 12:34 PM
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;
|
| |
|
Edit/Delete • Quote • Complain |

masterm1ne
Registered: Dec 2009
Posts: 798 |
08-16-12 08:49 PM
Quote from 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;
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
|
| |
|
Edit/Delete • Quote • Complain |

  |
| Receive
an email whenever a new post is added to this thread by subscribing
to it. |
|
|
|
|