LONG only with green daily cande

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #213164 quote
    Aragorna
    Participant
    Junior

    Hi there,

    I have a question that could be very easy to answer for who is better than me starting code. How can I say Buy long only when daily candle crosses zero line from red to green and viceversa? except for the exact moment it forms for the first time, that should be early in the morning. thank’s in advance

    Alessio

    #213173 quote
    ZeroCafeine
    Participant
    Senior

    I want to help but don’t understand exactly what do you want to do, buy when DayClose > DayOpen ?

    TimeFrame(Daily)
    IF Close > Open Then
    Buy 1 shares at market
    ELSIF Close < Open Then
    SellShort 1 shares at market
    ENDIF
    #213181 quote
    JS
    Participant
    Senior

    Hi,

    If I understand correctly, you must use a smaller time frame than the daily time frame, for example 5 minutes or 1 hour…

    Your starting point is the daily open and then you check whether the Close crosses over or below the daily open…

    DefParam CumulateOrders=False
    
    TimeFrame(1 hour)
    DailyOpen = DOpen(0)
    If Close crosses over DailyOpen then
    Buy 1 contract at Market
    ElsIf Close crosses under DailyOpen then
    SellShort 1 contract at Market
    EndIf
    ZeroCafeine thanked this post
    #213202 quote
    Aragorna
    Participant
    Junior
    Yes, thank’s, that’ the idea. I’ll test it soon.
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

LONG only with green daily cande


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Aragorna @aragorna Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/12/2023
Status: Active
Attachments: No files
Logo Logo
Loading...