Click here to Login





                                                   Zweig's 4% model

  0

0
Amritendu Maji
2017-07-21 23:57:38


Zweig's 4% model in Metastock:

a:=If(PREV=1,If(CLOSE<HighestSince(1,PREV<>1,CLOSE)*.96,-1,PREV),If(PREV=-1,If(CLOSE>LowestSince(1,PREV<>-1,CLOSE)*1.04,+1,PREV),If(PREV=0,If(CLOSE>Lowest(CLOSE)*1.04,+1,If(CLOSE<Highest(CLOSE)*.96,-1,PREV)),PREV)));
D:=If(A=1,1,0);
LE:=D=1;
SE:=D=0;

What is the equivalent in QL?

Thank you,
Maji



Amritendu Maji
2017-07-22 00:03:40

  0

In Easylanguage it is as follows:

inputs: perOffLo(4.00), { percent off lowest close }
perOffHi(4.00); { percent off highest close }

variables: LC(0), { lowest close }
HC(0), { highest close }
trend(0); { 0 = no trades yet, +1 = up, -1 = down }

{ initialize variables }
if currentBar = 1 then begin
LC = close;
HC = close;
trend = 0;
end;

{ update trend variable and place trading orders }
if trend = 0 then begin
if ((close-LC) / LC) >= (perOffLo / 100) then trend = +1;
if ((HC-close) / HC) >= (perOffHi / 100) then trend = -1;
end
else if trend = +1 and ((HC-close) / HC) >= (perOffHi / 100) then begin
sell short this bar on close;
trend = -1;
LC = close;
end
else if trend = -1 and ((close-LC) / LC) >= (perOffLo / 100) then begin
buy this bar on close;
trend = +1;
HC = close;
end;

{ update LC & HC variables }
if close < LC then LC = close;
if close > HC then HC = close;



Amritendu Maji
2017-07-27 01:37:37

  0

Can you just write the Buy logic of this system?

Thank you.



QuantShare
2017-07-27 10:49:44

  0

Please contact support if you want that one of our programmers implement the indicator for you.


Amritendu Maji
2017-07-27 15:35:11

  0

I am not asking you to write the whole indicator... I am just looking at a few lines of code that can get me started. How Roy set up
The long entry would be very helpful.




No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Black-Scholes Option Pricing Model formula
Flexible Asset Allocation Model V1.0
Sector Surfer AMM Model
Butler Adaptive Asset Allocation Model V1.0
Sector Rotation Model - SRM

How-to Lessons
How to create and trade a Neural Network model
How to optimize a neural network using a genetic algorithm
How to create histogram charts
How to create a composite index/indicator
How to quickly select stocks based on the last value of a databas...

Related Forum Threads
Zweig Indicator Function
Prediction Model - Entry Rule
Error while trying to construct example Neural Net Model
SUB:- "NO SYMBOL SPECIFIED" WHEN FINISH BUTTON IS CLICKED TO CRE...
neural network

Blog Posts
Trading Optimization
Forecast volatility using trading rules and neural networks
Stock Market Prediction with QuantShare
Stock Market Prediction
How to create and backtest thousands of trading rules in less tha...









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.