sample code

Discussion in 'App Development' started by clarodina, Apr 8, 2014.

  1. anyone has a sample code for the following?

    buy whn stoch<30 and exit 5 bars from entry

    if next day stoch is <30 buy another unit and exit 5 bars from entry

    if next next day stoch is <30 buy another unit and exit 5 bars from entry

    try code them but the second and third entry all exit at the first exit altogether rather 5 bars from entry
     
  2. 2rosy

    2rosy

    add entry date and then do a diff
     
  3. can u give a sample ? tks
     
  4. multicharts software
     
  5. Want to have each stoch<30 buy to exit 5 bars from entry individually even marketposition =1
     
  6. bump
     
  7. Come up with this code but is not dynamic

    Any bars with stoch above 30 render the subsequent signals not registered

    Anyone would tweak the code to account all signals?

    If Count1 = 0 and Count2 = 0 and Count3 = 0 and Stock < 30 then begin
    Buy x shares this bar on close;
    Count1 = BarNumber
    end;

    If Count1 <> 0 and BarNumber >= Count1 + 5 then begin
    Sell X shares this bar on close;
    Count1 = 0;
    end;

    If Count1 <> 0 and BarNumber = Count1 + 1 and Count2 = 0 and Stoch < 30 then Begin
    Buy x shares this bar on close;
    Count2 = BarNumber
    end;

    If Count2 <> 0 and BarNumber >= Count2 + 5 then begin
    Sell X shares this bar on close;
    Count2 = 0;
    end;
     
  8. try commenting your pseudo code to get a clearer picture of what you're doing.

    for example, why are you using 3 counts? what are you trying to achieve with each loop? why is it there ?