VWAP Automated Order

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

    Hi Guys,

    Would any of you wizards be able to create a pro order strategy using an adjustable timeframe but mainly 1 minute and 5 minute using the VWAP indicator.

    Buy Conditions

    Condition 1

    Price crosses above VWAP

    Condition 2

    Next bar closes higher than the VWAP

    execute order at next bar

    Sell (Short) Conditions

    The exact opposit of the Buy Condition

    Exit Conditions

    Still toying with this but would like the ability to backtest different variatons of a trailing stop by pips, % and value.

    jgugyugiug.png jgugyugiug.png
    #135689 quote
    Nicolas
    Keymaster
    Master

    That below code should trigger the orders based on the VWAP cross you described:

    if day<>day[1] then
    d=0
    else
    d=d+1
    if volume >0 then
    VWAP = SUMMATION[d](volume*typicalprice)/SUMMATION[d](volume)
    endif
    endif
    
    if close crosses over vwap then 
    buybar=barindex
    endif
    
    if close crosses under vwap then 
    sellbar=barindex
    endif 
    
    if barindex-buybar=1 and not longonmarket then 
    if close > vwap then 
    buy at market 
    endif
    endif 
    
    if barindex-sellbar=1 and not shortonmarket then
    if close < vwap then
    sellshort at market
    endif
    endif 
    
    set stop ptrailing 15 //change to whatever kind of trailing stop here: ptrailing, %trailing

    Change the trailing stop instruction to the desired one (last line of the code).

    #135702 quote
    Plaedies
    Participant
    Junior

    Thank you @Nicolas

    This is exactly what I wanted perfect! just one question around the position sizing. I did not see an element within the code that allows what the entry position size should be?

    #135703 quote
    Nicolas
    Keymaster
    Master

    change line 20 with “buy 1 contract at market”, do the same for the sellshort order.

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

VWAP Automated Order


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Plaedies @plaedies Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 06/12/2020
Status: Active
Attachments: 1 files
Logo Logo
Loading...