Easylanguage question

Discussion in 'Trading Software' started by intradaybill, Mar 6, 2008.

  1. Hello,

    I want to buy after two consecutive down gaps at the open of next day and sell at the close of same day. I'm trying to learn EL before I commit to an account. Will this code work?

    if L[2] > H[1] AND L[1] > H[0] then begin
    Buy Next Bar at open;
    sell next bar at close;
    end;

    I don't know whether the sell command to exit position can be activated if inside the conditional and before a position is established.

    Thanks,

    Bill
     
  2. I'm not sure but you may have to check MarketPosition first, like in:

    If MarketPosition = 1 then
    sell next bar at close;

    John
     
  3. Tums

    Tums

  4. For daily bars, that will basically work because the orders placed will most certainly result in fills. So in this particular case, MarketPosition is not really needed unless you want to place these orders only when already flat.
    In that case, just qualify the orders:
    If MarketPosition = 0 Then
    if L[2] > H[1] AND L[1] > H[0] then begin
    Buy Next Bar at open;
    sell next bar at close;
    end;
    End;
     
  5. This code will buy the open on the 3rd bar after 2 gaps down . The sell command is issued correctly and does not require a position before you send it.
     
  6. Thank you all.

    Another question: if the third bar forms another down gap, will the code generate a new entry at the open of the fourth bar?

    Bill
     
  7. Yes, assuming you are not filled on the 3rd bar.
     
  8. No. If he does not use my code to check his MarketPosition, he will just increase the size of his long position.
     
  9. only if he is allowing multiple entries.
     
  10. Tums

    Tums

    #10     Sep 2, 2008