Trade only from 7.45 am untill 18.00 pm

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #8779 quote
    PjotterdPjotterd
    Participant
    Average

    Hi, I want to set up automated trading, but I only want to do this with a strategy that is working daily from 7.45 AM untill 18.00 PM. Is this possible to set up? Thanks in advance.

    #8781 quote
    AdolfoAdolfo
    Participant
    Senior

    Yes it is!

    IF TIME>=074500 AND TIME<180000 THEN
    Trading=1
    ELSE
    Trading=0
    ENDIF

    Just add “if trading=1” to your condition to enter market

    cheers

    #8782 quote
    AdolfoAdolfo
    Participant
    Senior

    There is another way to even exit at market if end time reach.

    DEFPARAM FLATBEFORE = 074500
    DEFPARAM FLATAFTER = 180000

    Advise: those lines must be at first lines before code

    #8786 quote
    PjotterdPjotterd
    Participant
    Average

    Thanks guys! It works!

    #8804 quote
    grizzlygrizzly
    Participant
    Average

    I’ve never tried, but is there a way to Conditionalise DEFPARAM FLATAFTER so that if a position in profit is open, it won’t close ?

    #8806 quote
    GraHalGraHal
    Participant
    Legend

    Yes I need this too Grizzly, but something like the opposite …

    If position is at Loss < – L then don’t close until time T or Loss > 0

    Logic being that without above condition you may be closing near the bottom of a short term cycle / wave which may recover somewhat in  1 or 2 hours.

    Thanks

    GraHal

    #8808 quote
    NicolasNicolas
    Keymaster
    Legend

    @grizzly and @GraHal

    With POSITIONPERF you can easily test if the actual positions are in profit. If so, make a conditional statement to close the basket or not accordingly to the present time.

    #8811 quote
    GraHalGraHal
    Participant
    Legend

    Hi Nicolas, thanks

    Yes I use Positionperf a lot, it is very very useful.

    2 days ago one of my positions closed under a FlatAfter rule with a near £2,500 loss (it was only Demo!)  I checked after and it would have recovered a few hours later.

    So it was the above that prompted my question after Grizzly asking also.

    Its just that I have started using Strategies in French etc and so tweaking existing code (to add Positionperf) is not straightforward (I am english only), but I’ll get there with the help of google translate and learn French also! ha

    Cheers

    GraHal

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Trade only from 7.45 am untill 18.00 pm


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Pjotterd @pjotterd Participant
Summary

This topic contains 7 replies,
has 5 voices, and was last updated by GraHalGraHal
10 years, 5 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 06/03/2016
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...