Parabolic sar 15 min and macd daily

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

    hello, I would like help coding an automatic script that buys in 15 min graph when parabolic sar is green and sells when parabolic sar is red and the daily graph macd cross over zero and go short when parabolic sar 15 min is red and sell when it is green and daily chart macd is below 0

    #223871 quote
    MauroPro
    Participant
    Veteran

    Try this:

    defParam cumulateOrders = false
    defParam preLoadBars = 10000
    defParam flatAfter = 220000
    positionSize = 1
    //------------------------------------------------------------
    timeframe(1 day, updateOnClose)
    myMacd = average[12,1] - average[26,1]
    c1L = myMacd crosses over 0
    c1S = myMacd crosses under 0
    //--------------------------------------------------------------
    timeframe(15 minutes, updateOnClose)
    mySAR  = sar[0.02,0.02,0.2]
    greenSar  = close > MySAR
    redSar    = close < MySAR
    changeColor = (greenSar and redSar[1]) or (greenSar[1] and redSar)
    c2L = greenSar
    c2S = redSar
    
    if not onMarket and c1L and c2L then
    buy positionSize contracts at market
    endif
    if longOnMarket and changeColor and redSar then
    sell positionSize contracts at market
    endif
    
    if not onMarket and c1S and c2S then
    sellShort positionSize contracts at market
    endif
    if shortOnMarket and changeColor and greenSar then
    exitShort positionSize contracts at market
    endif
    
    robertogozzi and kvacksa87 thanked this post
    #223876 quote
    kvacksa87
    Participant
    New

    Thank you so much for fast Replay . I shall try it 😁

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

Parabolic sar 15 min and macd daily


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
kvacksa87 @kvacksa87 Participant
Summary

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

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