Start_Trading: Start_Trading

Description Usage Arguments Value Examples

View source: R/Start_Trading.R

Description

This function starts the Algorithm and sends the ordes to txt file that will be read for the Expert Advisor in the Metatrader 5.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Start_Trading(
  consumer_key,
  consumer_secret,
  access_token,
  access_secret,
  path_decision,
  ntweets,
  terms_list,
  time_tweet,
  time_zone,
  positive_dictionary,
  negative_dictionary,
  stock_symbol,
  path_twits,
  Operation_Hours1,
  Operation_Hours2,
  Operation_Hours3,
  start_time1,
  start_time2,
  start_time3,
  end_time1,
  end_time2,
  end_time3,
  Day_Trade,
  nap_time_error,
  initial_time,
  final_time,
  freq_trade,
  w_twitter,
  w_stocktwits,
  Sentiment_Index_Threshold,
  Use_Delta_Sentiment,
  Signal_File_Name
)

Arguments

consumer_key

Api Twitter Consumer Key

consumer_secret

Api Twitter Consumer Secret

access_token

Api Twitter access token

access_secret

Api Twitter access secret

path_decision

The path where the txt file with the decision will be saved. Generally it is saved in the 'Common' file at Metaquotes folder(see vignette for instructions).

ntweets

see get_sentiment_tweets.

terms_list

see get_sentiment_tweets.

time_tweet

see get_sentiment_tweets.

time_zone

see get_sentiment_tweets.

positive_dictionary

see get_sentiment_tweets.

negative_dictionary

see get_sentiment_tweets.

stock_symbol

see get_sentiment_Stocktwits.

path_twits

see get_sentiment_Stocktwits.

Operation_Hours1

The operation hours 1 for day trade. TRUE or FALSE.

Operation_Hours2

The operation hours 2 for day trade. TRUE or FALSE.

Operation_Hours3

The operation hours 3 for day trade. TRUE or FALSE.

start_time1

The start time 1 for day trade.

start_time2

The start time 2 for day trade.

start_time3

The start time 3 for day trade.

end_time1

The end time 1 for day trade.

end_time2

The end time 2 for day trade.

end_time3

The end time 3 for day trade.

Day_Trade

True for Day Trade. False for Swing Trade.

nap_time_error

The time that the EA should take a nap in case of error.

initial_time

The start of operation.

final_time

The time which the position in day trade mode must be closed.

freq_trade

The time in minutes the EA must recompute the sentiment index and take a decision.

w_twitter

The weight of the twitter sentiment index.

w_stocktwits

The weight of the stocktwits sentiment index.

Sentiment_Index_Threshold

see trade_decision function.

Use_Delta_Sentiment

see trade_decision function

Signal_File_Name

The Signal File Name.

Value

The functions just activate the algorithm.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
## Not run: 
#Not run:
Signal_File_Name <- 'Signal.txt'
ntweets <- 5000
time_tweet <- 6
terms_list <- c("IBOVESPA OR bovespa OR ibov OR petroleo OR $SPX OR $SPY OR $EWZ")
time_zone <- "Brazil/East"
positive_dictionary <- my_dictionary[['positive_terms']]
negative_dictionary <- my_dictionary[['negative_terms']]

path_twits <- 'your path'
stock_symbol <- c("EWZ", "SPX", "SPY", "USO")
time_zone <- "Brazil/East"

consumer_key <- "your consumer_key"
consumer_secret <- "your consumer_secret"
access_token <- "your access token"
access_secret <- " your access secret "
nap_time_error <- 7.7
path_decision <- 'metatrader txt file path'
path_twits <- 'your path'
initial_time <- 9
final_time <- 17
freq_trade <- 10
Day_Trade <- TRUE
Operation_Hours1 <- TRUE
start_time1 <- 9
end_time1 <- 17
w_twitter <- 0.9
w_stocktwits <- 0.1
Sentiment_Index_Threshold <- 0.5


Start_Trading(consumer_key = consumer_key,
             consumer_secret = consumer_secret,
             access_token = access_token,
             access_secret = access_secret,
             path_decision = path_decision,
             ntweets = ntweets,
             terms_list = terms_list,
             time_tweet = time_tweet,
             time_zone = time_zone,
             positive_dictionary = positive_dictionary,
             negative_dictionary = negative_dictionary,
             stock_symbol = stock_symbol,
             path_twits = path_twits,
             Operation_Hours1 = TRUE,
             Operation_Hours2 = FALSE,
             Operation_Hours3 = FALSE,
             start_time1 = start_time1,
             start_time2 = start_time1,
             start_time3 = start_time1,
             end_time1 = end_time1,
             end_time2 = end_time1,
             end_time3 = end_time1,
             Day_Trade = TRUE,
             nap_time_error = nap_time_error,
             initial_time = initial_time,
             final_time = final_time,
             freq_trade = freq_trade,
             w_twitter = w_twitter,
             w_stocktwits = w_stocktwits,
             Sentiment_Index_Threshold = Sentiment_Index_Threshold,
             Use_Delta_Sentiment = TRUE,
             Signal_File_Name = Signal_File_Name)

## End(Not run)

TwitterAutomatedTrading documentation built on July 1, 2020, 5:48 p.m.