[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

EL coding problem / please help



PureBytes Links

Trading Reference Links

I've been working on a system for some time. I try constructing indicators
etc before trying to write any system code for money management, but wish to
have the indicators to visualise if my concept maybe justified and 'prove'
my system coding maybe on track if used.

Problem: On constructing an indicator that is scaled same as price for
exits, I cannot get it to work. I have two oscillators that crossover
(subgraph - based on data1, data2, & data3). Pending a cross  up (exitlong)
or down (exitshort) I'm trying to get the price scaled indicator to plot
only above or below the bars applicable to a condition of being long or
short.

Instead, say when marketposition = 1 the indicator continues to plot for a
scenario of marketposition = -1.

I've tried some EL code including the 'While' loop. But cannot do it right.
My TS4 jams each time I try to load it. Following is the closest I've been
able to get:

Inputs: Stp1(0.14);
Vars: Top(0), Bot(0);

Top = High + Stp1;
Bot = Low - Stp1;
Condition1 = wspr(d1d3) > cotmom(2,5);
Condition2 = wspr(d1d3) < cotmom(2,5);
{......go short......} Condition3 = cotmom(2,5) crosses above wspr(d1d3);
{......go long.......} Condition4 = cotmom(2,5) crosses below wspr(d1d3);
Condition5 = cotmom(2,5) crosses above 0;
Condition6 = cotmom(2,5) crosses below 0;
Condition7 = Condition5 = True or Condition6 = True;

If Condition4 then begin    {......go long.......}
 Value1 = Bot;
 If Condition7 then Value1 = Bot;
 If Condition3 then Value1 = Top;
end;

If Condition3 then begin    {......go short.......}
 Value1 = Top;
 If Condition7 then Value1 = Top;
 If Condition4 then Value1 = Bot;
end;

If Condition1 then Plot1(Value1,"exitlong")             {one colour}
else Plot2(Value1,"exitshort");                               {different
colour}