Buy at the high of the previous candle

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #83529 quote
    Hiraokii
    Participant
    Junior

    hi guys, I am a beginner even reading the documentation I have some doubts,

    i want to create a pending order as soon as the price broke the previous high line and the stop at the previous low. I don’t know why but it’s not doing what I want, it’s buying but not where I want.

     

    If not longonmarket then
    If close >= high[1] then
    Buy 1 lot at high[1] stop
    
    If longonmarket and close <= low[1] then 
    Sell at market
    Set target profit range[1]
    Endif
    Endif
    Endif
    
    #83530 quote
    Vonasi
    Moderator
    Master

    It should be a LIMIT order and not a STOP order plus some of your other code is incorrect. Try this?

    If not longonmarket and close >= high[1] then
    Buy 1 lot at high[1] limit
    Set target profit range[1]
    endif
     
    If longonmarket and close <= low[1] then 
    Sell at market
    Endif
    
    #83532 quote
    Hiraokii
    Participant
    Junior

    Thanks brother, not abusing but… the method to do the oposit and sell.
    Let’s say that I am sellshort, the sell at market will not stop the operation right? Should I buy at market instead?

    #83536 quote
    Vonasi
    Moderator
    Master

    If you SELLSHORT then to exit the trade you must EXITSHORT.

    If you BUY then to exit the trade you must SELL.

    If you have a long position open and SELLSHORT then the long position will be closed.

    If you have a short position open and BUY then the short position will be closed.

    Use two strategies – one for long and one for short if you want to avoid this.

    #83549 quote
    Hiraokii
    Participant
    Junior

    Thanks brother.

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

Buy at the high of the previous candle


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Hiraokii @hiraokii Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 10/25/2018
Status: Active
Attachments: No files
Logo Logo
Loading...