Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Open Position on daily Open

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Open Position on daily Open

    Hello,
    Could anyone help with this task?
    I use daily graph and I'd like to programm strategy which open a position on Daily OPEN if this OPEN is lower then previous CLOSE.
    But it always open the position next day.


    I guess that this code is completely wrong but I have change it many times and I am feel really lost...
    Code:
    			
    if (BarsInProgress == 1)
    {
    	openPrice = GetCurrentAsk();
    }
    			
    if (BarsInProgress == 0)
    {
    	if (Time[0].DayOfWeek == DayOfWeek.Friday)
    	{
    		lastFridayClose = Close[0];
    		tradeProceed = false;
    		BackColor = Color.LightSkyBlue;
    	}
    				
    	if (openPrice < lastFridayClose && !tradeProceed)
    	{
    		tradeProceed = true;
    		EnterLong(1, 1, "Long: 1min");
    		BackColor = Color.Chartreuse;
    	}
    }
    Thanks a lot for your support.

    Martin
    Last edited by Luigio; 01-19-2013, 12:56 PM.

    #2
    Hi again,

    I have already solved .
    So, for others how would spend a lot of time the same topick, it is really simple:
    Code:
    protected override void Initialize()
    {
            CalculateOnBarClose = true;
            ExitOnClose = true;
            ExitOnCloseSeconds = 30;
            Enabled = true;
           [B][COLOR="Red"] Add(PeriodType.Minute, 1);[/COLOR][/B]
    }
    protected override void OnBarUpdate()
    {
    	if (Open[[COLOR="Red"][B]-1[/B][/COLOR]] < Close[0] && Time[0].DayOfWeek == DayOfWeek.Friday)
    	{
    		EnterLong(0, 1, "Long: 1min");
    		BackColor = Color.Chartreuse;
    	}
    }
    Last edited by Luigio; 01-19-2013, 02:30 PM.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, Yesterday, 10:06 AM
    0 responses
    20 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    18 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    14 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    9 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    38 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X