CreateTimer (TimerCallback callback)
method
Timer that will be stopped at the end of the script
Syntax
public Timer CreateTimer (TimerCallback callback)
Parameters
callback — TimerCallback
Return
Timer
Returns the timer that will be stopped at the end of the script
Example
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using PTLRuntime.NETScript;
namespace Alert
{
public class Alert : NETStrategy
{
private static System.Threading.Timer aTimer;
public override void Init()
{
aTimer = CreateTimer(OnTimedEvent,null,0,500);
}
private void OnTimedEvent(object source)
{
runAlert();
}
private void runAlert()
{
Alert("Alert");
}
}
}
Discussion
Join PTMC community to post your comments
No comments yet. Be the first.
NETIndicator methods
- Alert (object[] args)
- ClearMarkers (int line)
- Comment (object[] args)
- Complete ()
- ConvertUTCTimeToSelectedTimeZone (DateTime timeUTC)
- CreateTimer (TimerCallback callback, object state, int dueTime, int period)
- CreateTimer (TimerCallback callback, object state, long dueTime, long period)
- CreateTimer (TimerCallback callback, object state, TimeSpan dueTime, TimeSpan period)
- CreateTimer (TimerCallback callback, object state, uint dueTime, uint period)
- GetHistoricalData (HistoricalDataRequest request)
- GetLastError ()
- GetLastErrorDescription ()
- GetValue (int line, int offset)
- GetValue (int line)
- IndicatorDigits (int digits)
- IndicatorShortName (string name)
- Init ()
- IsTesting ()
- NextBar ()
- OnPaintChart (object sender, PaintChartEventArgs args)
- OnQuote ()
- PlaySound (string fileName)
- Print (object[] args)
- QueueUserWorkItem (WaitCallback callBack)
- QueueUserWorkItem (WaitCallback callBack, object state)
- QueueUserWorkItem (WaitCallback callBack, object state, ApartmentState apartmentState)
- RemoveMarker (int line, int offset, Color color)
- SendEmail (string address, string subject, string body, string filename)
- SendEmail (string address, string subject, string body)
- SendEmail (string subject, string body)
- SetCloud (int cloudNumber, int index, int lineNumber, double value, int color, GradientMode gradientMethod)
- SetCloud (int cloudNumber, int index, int lineNumber, double value, int color, GradientMode gradientMethod, int offset)
- SetCloud (int cloudNumber, int index, double value1, double value2, int color1, int color2, GradientMode gradientMethod)
- SetCloud (int cloudNumber, int index, double value1, double value2, int color1, int color2, GradientMode gradientMethod, int offset)
- SetIndexDrawBegin (int index, int drawBegin)
- SetIndexEmptyValue (int index, double value)
- SetIndicatorLine (string name, Color color, int width, LineStyle style)
- SetLevelLine (string name, double level, Color color, int width, LineStyle style)
- SetLevelLine (string name, double level)
- SetLevelLine (int lineNumber, double level)
- SetLevelStyle (int draw_style, int line_width, int clr)
- SetLevelStyle (int levelIndex, int draw_style, int line_width, int clr)
- SetLevelValue (int index, double value)
- SetMarker (int line, int offset, Color color)
- SetValue (int line, int offset, double value)
- SetValue (int line, double value)
NETIndicator properties
- Accounts
- Ask
- Author
- Bid
- Comments
- Company
- Copyrights
- CurrentChart
- CurrentData
- DateOfCreation
- DrawSection
- ExpirationDate
- Fills
- HistogrammStyle
- Id
- Indicators
- Instruments
- LineColor
- LineNames
- LinesCount
- LineStyles
- LineTimeShift
- LineVisible
- LineWidth
- LineYFactor
- Orders
- Password
- Performance
- Point
- Positions
- ProjectName
- Refreshing
- SeparateWindow
- SingleThreadEvents
- SymbolCode
- Version
NETIndicator fields