Help With Code Please – Buy when the current price is higher than last close

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

    Hello, I would be extremely grateful if somebody could please provide me with help for a line of code. My code thus far is built for a 2 hourly chart and enters a buy when a new candle opens and the current price is above the Parabolic sar indicator, above the 20 day moving average & above the 50 day moving average. I want to add an additional line of code so the ‘buy’ only executes when all the above conditions are met  & if the current price is higher 2 minutes after the new candle opens than the closing price of the last candle. Can anybody help please?

    #14308 quote
    Nicolas
    Keymaster
    Master

    All conditions can be coded except the last one about the “current price is higher 2 minutes after the new candle opens than the closing price of the last candle” , which is impossible because code are only executed once at the bar close.

    How do you want to adapt your strategy?

    #14432 quote
    peterduk
    Participant
    New

    Thanks for your help Nicolas it’s greatly appreciated.

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

Help With Code Please – Buy when the current price is higher than last close


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
peterduk @peterduk Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 10/05/2016
Status: Active
Attachments: No files
Logo Logo
Loading...