Inserire ordini Limit e eliminazione dopo N. barre

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #205459 quote
    Simon
    Participant
    New

    Buongiorno Roberto,  potresti cortesemente spiegarmi come codificare un ordine limit  a un livello X prestabilito e cancellarlo se il livello non viene raggiunto nelle  3 barre successive?

    Ti ringrazio anticipatamente.

    #205492 quote
    robertogozzi
    Moderator
    Master

    Eccolo:

    ONCE Entrata = 0
    ONCE Barra   = 0
    IF OnMarket THEN
       Barra   = 0
       Entrata = 0
    ENDIF
    HH = highest[100](high)
    IF HH <> HH[1] THEN
       Barra   = BarIndex
       Entrata = HH
    ENDIF
    IF Entrata > 0 AND Not OnMarket THEN
       IF close > Entrata THEN
          Buy 1 Contract at Entrata LIMIT
       ELSIF close < Entrata THEN
          Buy 1 Contract at Entrata STOP
       ELSE
          Buy 1 Contract at Market
       ENDIF
    ENDIF
    IF Not OnMarket AND (Entrata > 0) AND (BarIndex - Barra) = 3 THEN
       Barra   = 0
       Entrata = 0
    ENDIF
    SET STOP   pLOSS   100
    SET TARGET pPROFIT 200
    //graph Not OnMarket AND (Entrata > 0) AND (BarIndex - Barra) < 3
    //graph HH <> HH[1] coloured("Red")
    Simon thanked this post
    #205507 quote
    Simon
    Participant
    New

    Grazie Roberto, gentilissimo come al solito.

    Buona giornata.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Inserire ordini Limit e eliminazione dopo N. barre


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Simon @simontemp Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Simon
3 years, 2 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 12/09/2022
Status: Active
Attachments: No files
Logo Logo
Loading...