Code: Select all
//INDICATOR to chart moving avg based on 3 bar high and low prices.
INPUT :
LENGTH(3), DISPLACE(-1);
Variables:
varDA (0),
varDB (0);
varDA = Average(High, LENGTH); //average * for daily time frame
varDB = Average(Low, LENGTH); ///avg * for weekly frame
IF DISPLACE <= 0 THEN BEGIN
PLOT1[DISPLACE](varDA,"DA");
PLOT2[DISPLACE](varDB,"DB");
END;
What I simply want to do in the signal is that when the current ask price is equal to the high average (varDA), I want to put in a limit order at the value of "varDA". However, the signal seems to be all over the place. The trigger price is always several ticks beyond the varDA. Appreciate any help in finding out what Im doing wrong here.
Code: Select all
INPUT :
LENGTH(3), DISPLACE(-1);
Variables:
intrabarpersist varDA (0),
intrabarpersist varDB (0);
varDA = Average(High, LENGTH);
varDB = Average(Low, LENGTH);
[intrabarOrderGeneration = true];
condition1 = CurrentAsk[0] >= varDA[0];
if condition1 then begin
Buy ("Enter Long") 1 Contract Next Bar at varDA[0] Limit;
end;