Replies

mark.matheson2024
09 Nov 2024, 18:01 ( Updated at: 10 Nov 2024, 15:35 )

RE: Backtest: How to enter a trade at the Open of the *next* bar

firemyst said: 

If you're programming a bot, use the OnBar() method. 

using System;using System.Collections.Generic;using System.Linq;using System.Text;using cAlgo.API;using cAlgo.API.Collections;using cAlgo.API.Indicators;using cAlgo.API.Internals;namespace cAlgo{    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]    public class ThirdBarMarketOrderBot : Robot    {        private int barCount;        protected override void OnStart()        {            barCount = 0;        }        protected override void OnBar()        {            barCount++;            Print ("Bar count {0}", barCount);        }    }}

You can find more about it by googling “calgo onbar”

Thanks !


@mark.matheson2024