CERRAR A LOS 3 DIAS??

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #215489 quote
    josemijosemi
    Participant
    Average

    Hola a todos!! Me puede ayudar alguien a escribir cómo cerrar una posición larga/corta a los tres días?

    Y si abre la posición un viernes, que no cuente ni sábado ni domingo…gracias de antemano.

    #215493 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Ahi esta:

    IF Not OnMarket THEN
       Tally = 0
    ELSE
       IF DayOfWeek <> DayOfWeek[1] THEN
          IF DayOfWeek >= 1 AND DayOfWeek <= 5 THEN
             Tally = Tally + 1
          ENDIF
       ENDIF
    ENDIF
    IF Tally > 3 THEN
       SELL      at Market
       EXITSHORT at Market
    ENDIF
    Ema = Average[30,1](close)
    IF close CROSSES OVER Ema AND Not LongOnMarket  THEN
       BUY at Market
       Tally = 1
    ENDIF
    IF close CROSSES UNDER Ema AND Not ShortOnMarket  THEN
       SELLSHORT at Market
       Tally = 1
    ENDIF
    #215594 quote
    josemijosemi
    Participant
    Average

    gracias, pero no es exactamente lo que quiero Robert, solamente sería que si entra en una posición el martes, salga el viernes; ó que si entra en una posición el jueves salga el martes. Puedes ayudarme?

    #215615 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Ahi esta:

    IF Not OnMarket THEN
       Tally = 0
    ELSE
       IF DayOfWeek <> DayOfWeek[1] THEN
          IF DayOfWeek >= 1 AND DayOfWeek <= 5 THEN
             Tally = Tally + 1
          ENDIF
       ENDIF
    ENDIF
    IF Tally > 3 THEN
       SELL      at Market
       EXITSHORT at Market
    ENDIF
    Ema = Average[30,1](close)
    IF close CROSSES OVER Ema AND Not OnMarket  THEN
       BUY at Market
       Tally = 1
    ENDIF
    IF close CROSSES UNDER Ema AND Not OnMarket  THEN
       SELLSHORT at Market
       Tally = 1
    ENDIF
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

CERRAR A LOS 3 DIAS??


ProOrder: Trading Automático y Backtesting

New Reply
Author
author-avatar
josemi @josemi Participant
Summary

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

Topic Details
Forum: ProOrder: Trading Automático y Backtesting
Language: Spanish
Started: 05/31/2023
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...