Hi all,
Can anyone explains the logic of the coding? I mean is how is the Code being executed? More details below:
For example, if I would like to have an Automated system to monitor a particular stock, if it hits what I defined as “strategy”, it buy/sell for me.
In the Backtesting and Automatic Trading area, under the programming I should put in my codes. But I’m a newbie for this platform. Hence, I need to know how is the code being executed.
Q: Does it goes top down every line of code in assuming I set the TF to 1min?
Q: How do I set some constants that I could use in my later part to compare values?
Q: How do I initialize my variables ONCE only when starting the trade?
Q: Does the code being run when the 1min starts or end of the 1min? This is important factor to calculate the PIPs and if we should open the position. (I don’t understand here and couldn’t find any documentations on it. Maybe I didn’t find hard enough whole day 🙂
Sample logic:
// Code to buy/sell when conditions meet.
// Below I declare some constants.
Constant CAPITAL = 1000
Constant IGSPREAD = 3
Constant TPPIP = 30
// Here define some variables and initialize ONLY once.
BULL_FLAG = FALSE
BEAR_FLAG = FALSE
INRSI_FLAG = FALSE
// Below is some logic testing to turn my flag on or off.
if xxx = xxx then
BULL_FLAG = TRUE
end if.
// Below will test the FLAGS and decide buy or wait.