How to Call My indicator in Pro Order

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #214325 quote
    SkySurferBlueSkySurferBlue
    Participant
    New

    Hi so I created indicator called NFPDay and I calculate in there the Friday’s of the month.

    Then I call the NFPDAY and say if it is 1 Criteria is met. However it is not executing.

    Here is the code for the indicator and the ProOrder system

    //Name NFPDAY 
    //Count of Fridays in a month Indicator
    If Dayofweek = 4 Then
    NewFriday = 1
    else
    NewFriday =0
    endif
    If Month = Month[1] then
    Friday=Friday+NewFriday
    else
    Friday = NewFriday
    Endif
    Return Friday
    
    //Strategy Code
    DEFPARAM Flatafter = 153000
    Friday = Call "NFPDAY"
    IF Friday = 1 Then
    DayOK=1
    Else
    DayOk=0
    endif
    
    If Time = 093000 Then
    Active =1
    Else
    Active=0
    Endif
    
    If Close > Open Then
    Bull =1
    BeAR=0
    ELSe
    BEAR=1
    BULL=0
    endif
    
    // Conditions to enter long positions
    IF NOT LongOnMarket AND dayok and Active and Bull THEN
    BUY 1 CONTRACTS AT MARKET
    ENDIF
    
    // Conditions to enter short positions
    IF NOT ShortOnMarket AND dayok and Active and Bear THEN
    SELLSHORT 1 CONTRACTS AT MARKET
    ENDIF
    
    // Stops and targets : Enter your protection stops and profit targets here
    
    #214354 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    I suggest that you use OpenMonth and OpenDayOfWeek (they return the value at the opening of a candle)  instead of Month and DayOfWeek (which return the same value, but when a candle closes):

    //Name NFPDAY
    //Count of Fridays in a month Indicator
    
    If OpenMonth <> OpenMonth[1] then
       Friday = 0
    endif
    
    If (OpenDayofweek = 4) AND (OpenDayofweek <> OpenDayofweek[1]) Then
       NewFriday = 1
       If OpenMonth = OpenMonth[1] then
          Friday=Friday+NewFriday
       else
          Friday = NewFriday
       endif
    else
       NewFriday =0
    endif
    
    Return Friday
    SkySurferBlue thanked this post
Viewing 2 posts - 1 through 2 (of 2 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

How to Call My indicator in Pro Order


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzirobertogozzi
3 years, 4 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/08/2023
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...