wealth lab users...little problem here for you

Discussion in 'Automated Trading' started by killATwill, Jun 2, 2005.

  1. I would expect the code below to 1) color bars aqua, trade the same aqua-colored bars. this isn't the case. instead, the bars i am looking to identify are set to aqua, but different bars are traded. this seems bizarrely buggy to me, but since I'm a newbie, I must be doing something dreadully wrong. can an expert pls help? thanks!

    begin
    if (linearreg(bar-1, #close, 200) > priceopen(bar)) and
    (priceopen(bar -1) < priceopen(bar)) and
    (priceopen(bar) <> priceclose(bar)) then
    setbarcolor(bar, #aqua);
    end;

    begin
    if (linearreg(bar-1, #close, 200) > priceopen(bar)) and
    (priceopen(bar -1) < priceopen(bar)) and
    (priceopen(bar) <> priceclose(bar)) then
    buyatmarket(bar,'');
    sellatclose(bar,lastactiveposition,'');
    end;
     
  2. i even tried a boolean...comes out a little bit better...now it trades aqua bars with some non-aquas thrown in.
     
  3. rickty

    rickty

    Your code works as expected, i.e. aqua bars are traded bars.

    BTW, you don't need the two "begin" and "end" statements.

    Richard
     
  4. thanks rickty. turns out i had some additional code disrupting things.